BaseClass¶
-
class
hhpy.main.BaseClass[source]¶ Bases:
objectBase class for various classes deriving from this. Implements __repr__, converting to dict as well as saving to pickle and restoring from pickle. Does NOT provide __init__ since it cannot be used by itself
Methods Summary
copy()Uses copy.deepcopy to return a copy of the object from_dict(dct, VT_co])Restores self from a dictionary load(filename, f)Load self from file saved with save()using an arbitrary function that supports loading dictionaries.read_pickle(*args, **kwargs)Wrapper for BaseClass.load()using f = pandas.read_picklesave(filename, f)Save self to file using an arbitrary function that supports saving dictionaries. to_dict()Converts self to a dictionary to_pickle(*args, **kwargs)Wrapper for save()using f = pandas.to_pickleMethods Documentation
-
copy()[source]¶ Uses copy.deepcopy to return a copy of the object
Returns: Copy of self
-
from_dict(dct: Mapping[KT, VT_co])[source]¶ Restores self from a dictionary
Parameters: dct – Dictionary created from to_dict()Returns: None
-
load(filename: str, f: Callable = <function read_pickle>)[source]¶ Load self from file saved with
save()using an arbitrary function that supports loading dictionaries.Parameters: - filename – filename (path) of the file
- f – function to be used [optional]
Returns: None
-
read_pickle(*args, **kwargs)[source]¶ Wrapper for
BaseClass.load()using f = pandas.read_pickleParameters: - args – passed to load [optional]
- kwargs – passed to load [optional]
Returns: see load
-
save(filename: str, f: Callable = <function to_pickle>)[source]¶ Save self to file using an arbitrary function that supports saving dictionaries. Note that the object is implicitly converted to a dictionary before saving.
Parameters: - filename – filename (path) to be used
- f – function to be used [optional]
Returns: None
-
to_pickle(*args, **kwargs)[source]¶ Wrapper for
save()using f = pandas.to_pickleParameters: - args – passed to save [optional]
- kwargs – passed to save [optional]
Returns: see save
-