Advertisement
Guest User

Untitled

a guest
May 31st, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. In [34]: df = pd.DataFrame(np.random.randint(0,1,(60000, 10000)))
  2.  
  3. In [35]: df.shape
  4. Out[35]: (60000, 10000)
  5.  
  6. In [36]: df.info()
  7. <class 'pandas.core.frame.DataFrame'>
  8. RangeIndex: 60000 entries, 0 to 59999
  9. Columns: 10000 entries, 0 to 9999
  10. dtypes: int32(10000)
  11. memory usage: 2.2 GB
  12.  
  13. In [39]: df_int8 = df.astype(np.int8)
  14.  
  15. In [40]: df_int8.info()
  16. <class 'pandas.core.frame.DataFrame'>
  17. RangeIndex: 60000 entries, 0 to 59999
  18. Columns: 10000 entries, 0 to 9999
  19. dtypes: int8(10000)
  20. memory usage: 572.2 MB
  21.  
  22. In [41]: df_bool = df.astype(np.bool)
  23.  
  24. In [42]: df_bool.info()
  25. <class 'pandas.core.frame.DataFrame'>
  26. RangeIndex: 60000 entries, 0 to 59999
  27. Columns: 10000 entries, 0 to 9999
  28. dtypes: bool(10000)
  29. memory usage: 572.2 MB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement