unravel.tabular.edit_columns module#

Use tabular_edit_columns (edit_cols) from UNRAVEL to drop, keep, rename, or reorder columns in a CSV or XLSX file.

Usage:#

tabular_edit_columns -i ‘path/to/data/*.csv’ [-d col1 col2 … or -c col2 col1 …] [–rename OLD=NEW …] [-o output_dir/] [-v]

unravel.tabular.edit_columns.parse_args()[source]#
unravel.tabular.edit_columns.edit_columns(file_path, drop_cols, cols, rename=None, output_dir=None, verbose=False)[source]#

Load a CSV or XLSX file, process columns (drop/keep/reorder), and save the modified file.

Parameters:#

file_pathstr

Path to the input file (CSV or XLSX).

drop_colslist or None

List of column names to drop.

colslist or None

List of column names to keep and reorder (all others will be dropped).

renamelist or None

List of strings in the format OLD=NEW to rename columns.

output_dirstr or None

Path to the output directory. If None, saves in edit_cols directory next to the input file.

verbosebool

If True, prints additional information during processing.

unravel.tabular.edit_columns.main()[source]#