Ecsv#

class astropy.io.ascii.Ecsv[source]#

Bases: Basic

ECSV (Enhanced Character Separated Values) format table.

Th ECSV format allows for specification of key table and column meta-data, in particular the data type and unit.

See: astropy/astropy-APEs

Examples

>>> from astropy.table import Table
>>> ecsv_content = '''# %ECSV 0.9
... # ---
... # datatype:
... # - {name: a, unit: m / s, datatype: int64, format: '%03d'}
... # - {name: b, unit: km, datatype: int64, description: This is column b}
... a b
... 001 2
... 004 3
... '''
>>> Table.read(ecsv_content, format='ascii.ecsv')
<Table length=2>
  a     b
m / s   km
int64 int64
----- -----
  001     2
  004     3

Attributes Summary

Methods Summary

read(table)

Read the table and return the results in a format determined by the outputter attribute.

update_table_data(table)

Update table columns in place if mixin columns are present.

Attributes Documentation

max_ndim = None#

Methods Documentation

read(table)[source]#

Read the table and return the results in a format determined by the outputter attribute.

The table parameter is any string or object that can be processed by the instance inputter. For the base Inputter class table can be one of:

  • File name

  • File-like object

  • String (newline separated) with all header and data lines (must have at least 2 lines)

  • List of strings

Parameters:
tablestr, file-like object, list

Input table.

Returns:
tableTable

Output table

update_table_data(table)[source]#

Update table columns in place if mixin columns are present.

This is a hook to allow updating the table columns after name filtering but before setting up to write the data. This is currently only used by ECSV and is otherwise just a pass-through.

Parameters:
tableastropy.table.Table

Input table for writing

Returns:
tableastropy.table.Table

Output table for writing