ColumnNames
Source¶
Bases: Enum
Whether the column names read from a file or a pandas DataFrame are cleaned.
Cleaning removes what str.strip removes at the start and the end of each name: spaces, tabs, line breaks and
non-breaking spaces. The inside of a name is never changed.
Added in version 0.1.0
Examples:
import tempfile
from pathlib import Path
import numdaplot as ndp
path = Path(tempfile.mkdtemp()) / "vehicles.csv"
_ = path.write_text('"id_vehicule\n";speed\n1;50\n')
ndp.Table.from_csv(path, ndp.CsvReadOptions(separator=";")).column_names
# ['id_vehicule', 'speed']
Attributes¶
CLEANED = auto()
Source¶
The spaces, tabs and line breaks at the start and the end of each name are removed. Default value.
Added in version 0.1.0
Examples:
import tempfile
from pathlib import Path
import numdaplot as ndp
path = Path(tempfile.mkdtemp()) / "vehicles.csv"
_ = path.write_text('" id_vehicule\n";speed\n1;50\n')
options = ndp.CsvReadOptions(separator=";", column_names=ndp.ColumnNames.CLEANED)
ndp.Table.from_csv(path, options).column_names
# ['id_vehicule', 'speed']
KEPT = auto()
Source¶
Each name is kept as written.
Added in version 0.1.0
Examples:
import tempfile
from pathlib import Path
import numdaplot as ndp
path = Path(tempfile.mkdtemp()) / "vehicles.csv"
_ = path.write_text('" id_vehicule\n";speed\n1;50\n')
options = ndp.CsvReadOptions(separator=";", column_names=ndp.ColumnNames.KEPT)
ndp.Table.from_csv(path, options).column_names
# [' id_vehicule\n', 'speed']