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