Parsing Part of a file that is fixed width

224 views Asked by At

I've got a file that is fixed width in the first half and table delimited by "," in the second half. When I copy part of the file and save as another file, the python function pandas.read_fwf(file_path) works perfectly as read_fwf can infer column lengths.

However, when I try to use read_fwf(file_path, skiprows = 2, nrows = 75) to read only the fixed width part of the input file, it does not correctly infer the columns, and simply returns a DataFrame with 1 column.

Are there any workarounds or solutions

0

There are 0 answers