Created
October 19, 2018 09:18
-
-
Save rpicatoste/0d97488bcc247556ef1ccb9ccae497eb to your computer and use it in GitHub Desktop.
Testing dataframe with extra attributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
class MyDF(pd.DataFrame): | |
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
self.definition = 'my_definition' | |
my_df = MyDF() | |
my_df.__dict__ = df.__dict__.copy() | |
print(len(my_df)) | |
print(my_df.definition) | |
save_variables_to_pickle(my_df, 'my_df.pkl') | |
my_df2 = load_variables_from_pickle('my_df.pkl') | |
print(len(my_df2)) | |
print(my_df2.definition) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment