Csv

class astropy.io.ascii.Csv[source]

Bases: astropy.io.ascii.Basic

CSV (comma-separated-values) table.

This file format may contain rows with fewer entries than the number of columns, a situation that occurs in output from some spreadsheet editors. The missing entries are marked as masked in the output table.

Masked values (indicated by an empty ‘’ field value when reading) are written out in the same way with an empty (‘’) field. This is different from the typical default for astropy.io.ascii in which missing values are indicated by --.

Example:

num,ra,dec,radius,mag
1,32.23222,10.1211
2,38.12321,-88.1321,2.2,17.0

Methods Summary

inconsistent_handler(self, str_vals, ncols) Adjust row if it is too short.

Methods Documentation

inconsistent_handler(self, str_vals, ncols)[source]

Adjust row if it is too short.

If a data row is shorter than the header, add empty values to make it the right length. Note that this will not be called if the row already matches the header.

Parameters:
str_vals : list

A list of value strings from the current row of the table.

ncols : int

The expected number of entries from the table header.

Returns:
str_vals : list

List of strings to be parsed into data entries in the output table.