Pandas notes

From Simson Garfinkel
Revision as of 04:12, 26 June 2018 by Simson (talk | contribs) (Created page with "==Memory Ideas== print the data frame types: df.dtypes print if the data frame columns are dense are sparse: df.ftypes Other ideas: df.info() df.info(memory_...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Memory Ideas

print the data frame types:

   df.dtypes

print if the data frame columns are dense are sparse:

   df.ftypes

Other ideas:

   df.info()
   df.info(memory_usage='deep')
   df.memory_usage(deep=True)
   sys.getsizeof(df)
   

Convert the record_id field from an integer to a float

   surveys_df['record_id'] = surveys_df['record_id'].astype('float64')
   surveys_df['record_id'].dtype


References: