In [1]:
import numpy as np;
import pandas as pd
In [2]:
dtypes = ['int64', 'int8', 'float64', 'datetime64[ns]', 'timedelta64[ns]','complex128', 'object', 'bool']
In [3]:
n = 5000
data = dict([ (t, np.random.randint(100, size=n).astype(t)) for t in dtypes])
df = pd.DataFrame(data)
In [4]:
df.info()
In [5]:
pd.DataFrame(df.int8).info()
In [6]:
pd.DataFrame(df.int64).info()
In [7]:
df['categorical'] = df['object'].astype('category')
In [8]:
pd.DataFrame(df.categorical).info()
In [9]:
pd.DataFrame(df.object).info()
In [10]:
pd.DataFrame(df.categorical).head()
Out[10]:
In [11]:
pd.DataFrame(df.object).head()
Out[11]:
In [12]:
df['bool'].head()
Out[12]:
In [ ]: