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.

  • 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 .

  • **kwargs โ€“ Additional keyword arguments accepted by the generic writer API. This specialized writer always exports CSV files.

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')

Using the explicit namespace API >>> f3 = scp.csv.write(ds, โ€˜myfileโ€™)