Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In [34]: df = pd.DataFrame(np.random.randint(0,1,(60000, 10000)))
- In [35]: df.shape
- Out[35]: (60000, 10000)
- In [36]: df.info()
- <class 'pandas.core.frame.DataFrame'>
- RangeIndex: 60000 entries, 0 to 59999
- Columns: 10000 entries, 0 to 9999
- dtypes: int32(10000)
- memory usage: 2.2 GB
- In [39]: df_int8 = df.astype(np.int8)
- In [40]: df_int8.info()
- <class 'pandas.core.frame.DataFrame'>
- RangeIndex: 60000 entries, 0 to 59999
- Columns: 10000 entries, 0 to 9999
- dtypes: int8(10000)
- memory usage: 572.2 MB
- In [41]: df_bool = df.astype(np.bool)
- In [42]: df_bool.info()
- <class 'pandas.core.frame.DataFrame'>
- RangeIndex: 60000 entries, 0 to 59999
- Columns: 10000 entries, 0 to 9999
- dtypes: bool(10000)
- memory usage: 572.2 MB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement