- CSVFile.find_col(col, force_list=False)¶
Indexes the column headers in order to locate a column of data.shape.
Indexing can be by supplying an integer, a string, a regular experssion, a slice or a list of any of the above.
Integer indices are simply checked to ensure that they are in range
String indices are first checked for an exact match against a column header if that fails they are then compiled to a regular expression and the first match to a column header is taken.
A regular expression index is simply matched against the column headers and the first match found is taken. This allows additional regular expression options such as case insensitivity.
A slice index is converted to a list of integers and processed as below
A list index returns the results of feading each item in the list at
col (int, a string, a re, a slice or a list) – Which column(s) to retuirn indices for.
- Keyword Arguments
force_list (bool) – Force the output always to be a list. Mainly for internal use only
int, list of ints – The matching column index as an integer or a KeyError