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.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. Deprecated generic writer kwargs such as
protocol=anddescription=still emit aDeprecationWarning; removal remains warning-first and is governed by the SpectroChemPy deprecation lifecycle policy.
- Returns
out (
pathlibobject) – 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’)