Open naught101 opened 1 year ago
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] I have confirmed this bug exists on the main branch of pandas.
With this file:
test.txt:
# file :: atlas/series/CMIP5one/rcp85/monthly/world/time_tas_Amon_onemean_rcp85_000_world.dat 93.5000 17.9877 2093 1 2093 1 94.5000 18.0374 2094 1 2094 1 95.5000 18.0906 2095 1 2095 1 96.5000 18.1404 2096 1 2096 1 97.5000 18.2044 2097 1 2097 1 98.5000 18.2412 2098 1 2098 1 99.5000 18.2734 2099 1 2099 1 100.500 18.3431 2100 1 2100 1
In [3]: pd.read_fwf("test.txt", comment='#', header=None) Out[3]: 0 1 2 3 4 5 0 ile :: eries/C ne/r 5 mont / 1 93.5000 17.9877 2093 1 2093 1 2 94.5000 18.0374 2094 1 2094 1 3 95.5000 18.0906 2095 1 2095 1 4 96.5000 18.1404 2096 1 2096 1 5 97.5000 18.2044 2097 1 2097 1 6 98.5000 18.2412 2098 1 2098 1 7 99.5000 18.2734 2099 1 2099 1 8 100.500 18.3431 2100 1 2100 1
on larger files with more header columns, all rows are included in this way.
Comment lines are included in the dataframe
Comment lines should NOT be included in the dataframe
@naught101 this is reproducible but I don't see any parameter called "comment" in the read_fwf documentation
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
With this file:
test.txt:
on larger files with more header columns, all rows are included in this way.
Issue Description
Comment lines are included in the dataframe
Expected Behavior
Comment lines should NOT be included in the dataframe
Installed Versions