larray.Session¶
-
class
larray.Session(*args, **kwargs)[source]¶ Groups several array objects together.
Parameters: args : str or dict of str, array or iterable of tuples (str, array)
Name of file to load or dictionary containing couples (name, array).
kwargs : dict of str, array
List of arrays to add written as ‘name’=array, …
Examples
>>> arr1, arr2, arr3 = ndtest((2, 2)), ndtest(4), ndtest((3, 2))
create a Session by passing a list of pairs (name, array)
>>> s = Session([('arr1', arr1), ('arr2', arr2), ('arr3', arr3)])
create a Session using keyword arguments (but you lose order on Python < 3.6)
>>> s = Session(arr1=arr1, arr2=arr2, arr3=arr3)
create a Session by passing a dictionary (but you lose order on Python < 3.6)
>>> s = Session({'arr1': arr1, 'arr2': arr2, 'arr3': arr3})
load Session from file
>>> s = Session('my_session.h5')
Methods
__init__(*args, **kwargs)add(*args, **kwargs)Adds objects to the current session. apply(func, *args, **kwargs)Apply function func on elements of the session and return a new session. compact([display])Detects and removes “useless” axes (ie axes for which values are constant over the whole axis) for all array copy()Returns a copy of the session. dump(*args, **kwargs)dump_csv(*args, **kwargs)dump_excel(*args, **kwargs)dump_hdf(*args, **kwargs)filter([pattern, kind])Returns a new session with array objects which match some criteria. get(key[, default])Returns the array object corresponding to the key. items()Returns a view of the session’s items ((key, value) pairs). keys()Returns a view on the session’s keys. load(fname[, names, engine, display])Loads array objects from a file, or several .csv files. save(fname[, names, engine, overwrite, display])Dumps all array objects from the current session to a file. summary([template])Returns a summary of the content of the session. to_csv(fname[, names, display])Dumps all array objects from the current session to CSV files. to_excel(fname[, names, overwrite, display])Dumps all array objects from the current session to an Excel file. to_globals([names, depth, warn, inplace])Create global variables out of objects in the session. to_hdf(fname[, names, overwrite, display])Dumps all array objects from the current session to an HDF file. to_pickle(fname[, names, overwrite, display])Dumps all array objects from the current session to a file using pickle. transpose(*args)Reorder axes of arrays in session, ignoring missing axes for each array. values()Returns a view on the session’s values.