Module Expr Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Import alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list decorator_list Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad If CompareGt Call NameLoad NameLoad Num body Print BinOpMod Str Call NameLoad NameLoad Print Call AttributeLoad Str attr ListComp BinOpAdd BinOpAdd NameLoad Str NameLoad comprehension TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr orelse Print Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore ListComp NameLoad comprehension NameStore NameLoad CompareNotIn NameLoad NameLoad If CompareGt Call NameLoad NameLoad Num body Assign NameStore Call NameLoad NameLoad Return Call NameLoad Call NameLoad NameLoad Call NameLoad NameLoad orelse Return Dict decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Return Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Expr Call NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Expr Call NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list If CompareEq NameLoad Str body Assign NameStore Call NameLoad Call NameLoad Num Num keyword ListLoad Str Str Str Expr Call NameLoad NameLoad Print Str Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr Str Expr Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Print Str Assign NameStore Call NameLoad NameLoad Print Str Expr Call NameLoad NameLoad Assign NameStore Str Expr Call NameLoad NameLoad NameLoad Print BinOpMod Str NameLoad Assign NameStore Call NameLoad NameLoad Print BinOpMod Str NameLoad Expr Call NameLoad NameLoad
N/A N/A  Serialization interface for custom DataFrame objects.  Allows to save/load 
 for memory streams or files.  Because one cannot serialize DataFrames with
 custom attributes, this uses an intermediate object for that process.  Plan
 it implement pickling saved methods later (requires more work).  These are meant to 
 supplant the DataFrame's save() and load() methods when custom attributes must persist.
 
 Note, this program assesses custom attributes by inspecting your DataFrame's
 attributes using Python's builting function, dir().  It compares these to the
 attributes of an empty DataFrame.  This adds a bit of overhead, but should allow
 this program to work with new versions of pandas, as Dataframe's methods and attributes
 are likely to change.  Is there are better way to do this?
 
 The following four functions are defined:
   df_dumps:  Serialize a DataFrame into memory.  Returns serialized stream.
   df_dump:  Serialize a DataFrame into a file.  Returns None.
   df_loads: Return a DataFrame from a serialized stream.
   df_load: Return a Dataframe from a serialized file.
 
 See bottom of file for test cases:   N/A __author__ Adam Hughes N/A __maintainer__ Adam Hughes N/A __email__ hugadams@gwmail.gwu.edu N/A __status__ Prototype N/A cPickle operator attrgetter pandas DataFrame numpy.random randn TempDump N/A object N/A N/A  Temporary class to dump DataFrame object with custom attributes.  Custom attrubutes are
    passed in as a dictionary and then temporarily stored upon serialization as _metadict.  Upon
    deserialization, the attributes and values are re-appended to the DataFrame automatically. __init__ N/A N/A self dataframe metadict N/A N/A N/A N/A self dataframe dataframe N/A N/A self _metadict metadict N/A N/A N/A dfempty N/A DataFrame N/A defattrs N/A dir dfempty print_customattr N/A N/A df N/A N/A N/A Formatted output of all custom attributes found in a DataFrame.  For all
    attributes and methods, use dir(df). N/A metadict N/A _get_metadict df N/A N/A N/A len metadict 0 N/A N/A N/A 
Found %s custom attributes:
 N/A len metadict N/A N/A N/A join N/A N/A N/A k v N/A N/A k v N/A sorted N/A N/A metadict items N/A N/A No custom attributes found N/A _get_metadict N/A N/A df N/A N/A N/A  Returns dictionary of attributes in a dataframe not found in the default frame. N/A attrs N/A dir df N/A newattr N/A att N/A att attrs N/A att defattrs N/A N/A N/A len newattr 1 N/A N/A fget N/A attrgetter newattr N/A N/A dict N/A zip newattr N/A fget df N/A N/A N/A N/A df_dumps N/A N/A df N/A N/A N/A  Save dataframe as a stream into memory. N/A metadict N/A _get_metadict df N/A N/A N/A cPickle dumps N/A TempDump df metadict N/A df_dump N/A N/A df outfile N/A N/A N/A  Save dataframe as a file. N/A outstream N/A df_dumps df N/A f N/A open outfile w N/A N/A N/A f write outstream N/A N/A N/A f close N/A None N/A df_load N/A N/A infile N/A N/A N/A Returns dataframe from a serialized file  N/A f N/A open infile r N/A tempobj N/A N/A cPickle load f N/A N/A N/A f close N/A df N/A tempobj dataframe N/A N/A attr value N/A N/A N/A tempobj _metadict items N/A N/A N/A setattr df attr value N/A df N/A df_loads N/A N/A stream N/A N/A N/A  Returns dataframe from a serialized stream N/A tempobj N/A N/A cPickle loads stream N/A df N/A tempobj dataframe N/A N/A attr value N/A N/A N/A tempobj _metadict items N/A N/A N/A setattr df attr value N/A df N/A N/A N/A __name__ __main__ N/A N/A df N/A DataFrame N/A randn 3 3 columns N/A a b c N/A N/A print_customattr df N/A adding some attributes N/A N/A df name Billy N/A N/A df junk in the trunk N/A N/A print_customattr df N/A stream N/A df_dumps df N/A wrote dataframe to memory N/A dfnew N/A df_loads stream N/A restored from memory N/A N/A print_customattr dfnew N/A outfile dftest.df N/A N/A df_dump df outfile N/A N/A wrote dataframe to file %s outfile N/A dfnewnew N/A df_load outfile N/A N/A Restored from file%s outfile N/A N/A print_customattr dfnewnew