actio_python_utils.utils.get_csv_fields¶
- actio_python_utils.utils.get_csv_fields(fn, sep=',', sanitize=False, sanitize_with=(('.', '_'), ('-', '_')))[source]¶
Get the column names from the first line of the specified file and optionally replaces an arbitrary sequence of strings to others
- Parameters:
fn (
str
) – The path to the CSV to get column names fromsep (
str
, default:','
) – The field separatorsanitize (
bool
, default:False
) – Whether to apply the string replacements insanitize_with
sanitize_with (
Optional
[Iterable
[tuple
[str
,str
]]], default:(('.', '_'), ('-', '_'))
) – For each pair, replace the first string with the second
- Return type:
list
[str
]