larray.Session.save¶
-
Session.save(fname, names=None, engine='auto', overwrite=True, display=False, **kwargs)[source]¶ Dumps all array objects from the current session to a file.
Parameters: fname : str
Path for the dump.
names : list of str or None, optional
List of names of objects to dump. If fname is None, list of paths to CSV files. Defaults to all objects present in the Session.
engine : {‘auto’, ‘pandas_csv’, ‘pandas_hdf’, ‘pandas_excel’, ‘xlwings_excel’, ‘pickle’}, optional
Dump using engine. Defaults to ‘auto’ (use default engine for the format guessed from the file extension).
overwrite: bool, optional
Whether or not to overwrite an existing file, if any. Ignored for CSV files. 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.save('output.h5')
Save only some arrays
>>> s.save('output.h5', ['arr1', 'arr3'])
Update file
>>> arr1, arr4 = ndtest((3, 3)), ndtest((2, 3)) >>> s2 = Session([('arr1', arr1), ('arr4', arr4)]) >>> # replace arr1 and add arr4 in file output.h5 >>> s2.save('output.h5', overwrite=False)