save_obj

Contents

save_obj#

save_obj(obj: Any, path: str | CloudPath | Path, **kwargs) None[source]#

Save an object as a pickle (can save any Python objects).

Parameters:
  • obj (Any) – Any object serializable

  • path (AnyPathStrType) – Path where to write the pickle

Example

>>> output_pkl = 'D:/path/to/pickle.pkl'
>>> pkl_dict = {"A": np.ones([3, 3]),
                "B": datetime.today(),
                "C": SomeEnum.some_name}
>>> save_json(output_pkl, pkl_dict)