0% found this document useful (0 votes)
17 views

Data Type Objects

Uploaded by

warriors
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Data Type Objects

Uploaded by

warriors
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

 Data type objects ( 

dtype )

o numpy.dtype

o numpy.dtype.type

o numpy.dtype.kind

o numpy.dtype.char

o numpy.dtype.num

o numpy.dtype.str

o numpy.dtype.name

o numpy.dtype.itemsize

o numpy.dtype.byteorder

o numpy.dtype.fields

o numpy.dtype.names

o numpy.dtype.subdtype

o numpy.dtype.shape

o numpy.dtype.hasobject

o numpy.dtype.flags

o numpy.dtype.isbuiltin

o numpy.dtype.isnative

o numpy.dtype.descr

o numpy.dtype.alignment

o numpy.dtype.base

o numpy.dtype.metadata

o numpy.dtype.newbyteorder
o numpy.dtype.__reduce__

o numpy.dtype.__setstate__

slicing and indexing


axis 0 = no of rows

axis 1 = no of columns

MANIPULATING ARRAYS:
Both the numpy.reshape() and numpy.resize() methods are used to change
the size of a NumPy array.
The difference:
reshape() does not changes the original array but only returns the changed
array, whereas the resize() method returns nothing and directly changes the
original array.
NumPy array attributes
1. ndim
2. itemsize
3. nbytes ## itemsize * size
4. size
5. resize
6. T
7. real
8. imag
9. dtype
10. flat
11. shape
Converting arrays
1. tolist()
2. astype()
CREATING ARRAY VIEWS AND COPIES:
copy() : returns a copy of an array

view() : returns a view of an array

 The main difference between copy and view:


the copy is the new arra, physically stored at another location.  changes are made to the original array it
does not affect the copy, or vice- versa.
the view is the view of the original array, has the same memory location as the original array. when
changes are made to the original array it affects the view, or vice- versa.

Indexing with a list of locations:

You might also like