larray.Session.to_csv

Session.to_csv(self, fname, names=None, display=False, **kwargs)[source]

Dumps LArray, Axis and Group objects from the current session to CSV files.

Parameters
fnamestr

Path for the directory that will contain CSV files.

nameslist of str or None, optional

Names of LArray/Axis/Group objects to dump. Defaults to all objects present in the Session.

displaybool, optional

Whether or not to display which file is being worked on. Defaults to False.

Notes

  • each array is saved in a separate file

  • all Axis objects are saved together in the same CSV file named __axes__.csv

  • all Group objects are saved together in the same CSV file named __groups__.csv

  • all session metadata is saved in the same CSV file named __metadata__.csv

Examples

>>> # axes
>>> a, b = Axis("a=a0..a2"), Axis("b=b0..b2")    # doctest: +SKIP
>>> # groups
>>> a01 = a['a0,a1'] >> 'a01'                    # doctest: +SKIP
>>> # arrays
>>> arr1, arr2 = ndtest((a, b)), ndtest(a)       # doctest: +SKIP
>>> s = Session([('a', a), ('b', b), ('a01', a01), ('arr1', arr1), ('arr2', arr2)])  # doctest: +SKIP
>>> # metadata
>>> s.meta.title = 'my title'                    # doctest: +SKIP
>>> s.meta.author = 'John Smith'                 # doctest: +SKIP

Save all arrays

>>> s.to_csv('./Output')  # doctest: +SKIP

Save only some arrays

>>> s.to_csv('./Output', ['a', 'b', 'arr1'])  # doctest: +SKIP