Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A low memory dataframe native access point
import os
import pickle
class DynamoDataFrame:
def render_fhandle(self, mode='wb'):
return open(file=self.full_fpath, mode=mode)
def __init__(self, full_fpath=None, df=None):
self.full_fpath = full_fpath
if df is not None:
fhandle = self.render_fhandle()
pickle.dump(obj=df, file=fhandle)
fhandle.close()
def load_pickle(self):
return pickle.load(file=self.render_fhandle(mode='rb'))
def __getitem__(self, item):
return self.load_pickle()[item]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.