In [1]:
import pandas as pd
import numpy as np
In [2]:
s = pd.Series([0, 1, 2], dtype=np.float64)
print(s.dtype)
In [3]:
s = pd.Series([0, 1, 2], dtype='float64')
print(s.dtype)
In [4]:
s = pd.Series([0, 1, 2], dtype='f8')
print(s.dtype)
In [5]:
s = pd.Series([0, 1, 2], dtype='float')
print(s.dtype)
In [6]:
s = pd.Series([0, 1, 2], dtype=float)
print(s.dtype)
In [7]:
s = pd.Series([0, 1, 2], dtype='uint')
print(s.dtype)
In [8]:
s_object = pd.Series([0, 0.1, 'abc', pd.np.nan])
print(s_object)
In [9]:
print(s_object.map(type))
In [10]:
s_str_constructor = pd.Series([0, 0.1, 'abc', pd.np.nan], dtype=str)
print(s_str_constructor)
In [11]:
print(s_str_constructor.map(type))
In [12]:
s_str_astype = s_object.astype(str)
print(s_str_astype)
In [13]:
print(s_str_astype.map(type))
In [14]:
print(s_str_astype.str.len())
In [15]:
print(s_object.str.len())
In [16]:
print(s_object.astype(str).str.len())
In [17]:
print(s_object)
In [18]:
print(s_object.map(type))
In [19]:
print(s_object.isnull())
In [20]:
print(s_object.dropna())
In [21]:
print(s_str_astype)
In [22]:
print(s_str_astype.map(type))
In [23]:
print(s_str_astype.isnull())
In [24]:
print(s_str_astype.dropna())
In [25]:
s_str_astype_nan = s_str_astype.replace('nan', pd.np.nan)
print(s_str_astype_nan)
In [26]:
print(s_str_astype_nan.map(type))
In [27]:
print(s_str_astype_nan.isnull())