User Tools

Site Tools


numpy_notes

dtype

 % ipython            
Python 3.8.5 (default, Sep  4 2020, 07:30:14)
IPython 7.18.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 
import numpy as np
a = np.array([1, 50, 100, 150, 200, 250, 300])
b = np.array([1, 50, 100, 150, 200, 250, 300], dtype=float)

In [2]: 
a
Out[2]: 
array([  1,  50, 100, 150, 200, 250, 300])

In [3]: 
b
Out[3]: 
array([  1.,  50., 100., 150., 200., 250., 300.])

In [4]: 
a.dtype
Out[4]: 
dtype('int64')

In [5]: 
b.dtype
Out[5]: 
dtype('float64')
numpy_notes.txt · Last modified: 2021/05/07 14:36 by raju