ECSVEngine#
- class astropy.io.misc.ecsv.ECSVEngine[source]#
Bases:
objectBase class for ECSV reader engines.
An engine is responsible for reading the raw CSV data that follows the ECSV header. This assumes that the engine has a defined Table Unified I/O interface.
nameandformatmust be defined as class attributes in subclasses.enginesis a base class-level dictionary that maps engine names to their respective engine classes. Subclasses should not modify this directly.
- Parameters:
- name
str Name of the engine, used for
engineparameter in a call like:Table.read(filename, format="ecsv", engine="pyarrow").- format
str Format string for the engine CSV reader, e.g. “pyarrow.csv”, “ascii.csv”, etc.
- engines
dict[str,ECSVEngine] Dictionary mapping engine names to their respective engine classes.
- name
Attributes Summary
Methods Summary
convert_np_type(np_type)Convert a numpy type string to engine-specific type for parsing.
get_converters(header)Get a dictionary of converters for the columns in the ECSV header.
get_data_kwargs(header, null_values)Generate a dictionary of keyword arguments for data parsing.
Attributes Documentation
- engines = {'io.ascii': <class 'astropy.io.misc.ecsv.ECSVEngineIoAscii'>, 'pandas': <class 'astropy.io.misc.ecsv.ECSVEnginePandas'>, 'pyarrow': <class 'astropy.io.misc.ecsv.ECSVEnginePyArrow'>}#
- format = None#
- name = None#
Methods Documentation
- abstractmethod convert_np_type(np_type)[source]#
Convert a numpy type string to engine-specific type for parsing.
For instance, for pandas the
"int32"numpy type gets converted to anInt32Dtype()instance to read columns as a nullable int32.
- get_converters(header)[source]#
Get a dictionary of converters for the columns in the ECSV header.
This is used to convert column names to engine-specific types.
- Parameters:
- header
ECSVHeader The ECSV header containing column definitions.
- header
- Returns: