Warning

You are reading the documentation related to the development version. Go here if you are looking for the documentation of the stable release.

spectrochempy.write_csv

write_csv(*args, **kwargs)[source]

Write a dataset in CSV format.

Currently only implemented for 1D datasets or ND datasets with only one dimension of length larger than one.

Parameters
  • filename (str or pathlib object, optional) – If not provided, a dialog is opened to select a file for writing.

  • protocol ({‘scp’, ‘matlab’, ‘jcamp’, ‘csv’, ‘excel’}, optional) – Protocol used for writing. If not provided, the correct protocol is inferred (whnever it is possible) from the file name extension.

  • directory (str, optional) – Where to write the specified filename . If not specified, write in the current directory.

  • description (str, optional) – A Custom description.

  • delimiter (str, optional) – Set the column delimiter in CSV file. By default it is ‘,’ or the one set in SpectroChemPy Preferences .

Returns

out (pathlib object) – Path of the saved file.

Examples

>>> ds = scp.NDDataset([1, 2, 3])
>>> f1 = ds.write_csv('myfile')
>>> ds = scp.read('irdata/nh4y-activation.spg')
>>> f2 = ds[0].write_csv('single_spectrum.csv')