nipype.interfaces.utility.csv module

CSV Handling utilities

CSVReader

Link to code

Bases: BaseInterface

Examples

>>> reader = CSVReader()  # doctest: +SKIP
>>> reader.inputs.in_file = 'noHeader.csv'  # doctest: +SKIP
>>> out = reader.run()  # doctest: +SKIP
>>> out.outputs.column_0 == ['foo', 'bar', 'baz']  # doctest: +SKIP
True
>>> out.outputs.column_1 == ['hello', 'world', 'goodbye']  # doctest: +SKIP
True
>>> out.outputs.column_2 == ['300.1', '5', '0.3']  # doctest: +SKIP
True
>>> reader = CSVReader()  # doctest: +SKIP
>>> reader.inputs.in_file = 'header.csv'  # doctest: +SKIP
>>> reader.inputs.header = True  # doctest: +SKIP
>>> out = reader.run()  # doctest: +SKIP
>>> out.outputs.files == ['foo', 'bar', 'baz']  # doctest: +SKIP
True
>>> out.outputs.labels == ['hello', 'world', 'goodbye']  # doctest: +SKIP
True
>>> out.outputs.erosion == ['300.1', '5', '0.3']  # doctest: +SKIP
True
in_file : a pathlike object or string representing an existing file
Input comma-seperated value (CSV) file.
header : a boolean
True if the first line is a column header. (Nipype default value: False)
CSVReader.output_spec

alias of nipype.interfaces.base.specs.DynamicTraitedSpec