larray.Session.to_pickle¶
-
Session.to_pickle(fname, names=None, overwrite=True, display=False, **kwargs)[source]¶ Dumps all array objects from the current session to a file using pickle.
WARNING: never load a pickle file (.pkl or .pickle) from an untrusted source, as it can lead to arbitrary code execution.
Parameters: fname : str
Path for the dump.
names : list of str or None, optional
List of names of objects to dump. Defaults to all objects present in the Session.
overwrite: bool, optional
Whether or not to overwrite an existing file, if any. If False, file is updated. Defaults to True.
display : bool, optional
Whether or not to display which file is being worked on. Defaults to False.
Examples
>>> arr1, arr2, arr3 = ndtest((2, 2)), ndtest(4), ndtest((3, 2)) >>> s = Session([('arr1', arr1), ('arr2', arr2), ('arr3', arr3)])
Save all arrays
>>> s.to_pickle('output.pkl')
Save only some arrays
>>> s.to_pickle('output.pkl', ['arr1', 'arr3'])