ndarray Attributes

Description

We can call specific attributes of an ndarray to show or use in operations using the name of the array and the name of the attribute. Here, we will list some of the more useful attributes of an ndarray:

  • T: the transpose of the array
  • dtype: the data type of the array
  • real: an {ndarray}} containing the real part of the array's data. Useful for arrays of complex numbers.
  • imag: an ndarray containing the imaginary part of the array's data. Useful for arrays of complex numbers.
  • size: number of objects in the array
  • shape number of rows and columns in the array
  • ndim: number of dimensions of the array

Sage Cell

We call an attribute of an object using the object name, the attribute name and the dot operator:

Code

plot(sin(x),-10,10)

Options

none

Tags

Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.

Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.

Attribute

Permalink:

Author:

Date: 05 Apr 2019 01:17

Submitted by: Zane Corbiere

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License