-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read_fwf: skip_blank_lines does nothing #22693
Comments
Thanks for the report - investigation and PRs are certainly welcome |
The bug appears to be in |
I believe this bug also extends to Code sampleimport pandas as pd
from io import StringIO
csv_f = StringIO('''A,B,C,D
FOO,1,2,3
FOO,4,5,6
,,,
FOO,7,8,9
,10,11,12
,,,
,,,
,,,
,,,
,,,
'''
)
df = pd.read_csv(csv_f, header=None, skip_blank_lines=True)
print(df) Output
With |
Also possibly related to: #10164 |
Any updates on this? I'm still seeing this behavior in from io import StringIO
csv_file = StringIO('''lucode,desc,val1,val2
1,corn,0.5,2
,,,
3,peas,1,-2
'''
)
df = pandas.read_csv(csv_file, skip_blank_lines=True)
df
lucode desc val1 val2
0 1.0 corn 0.5 2.0
1 NaN NaN NaN NaN
2 3.0 peas 1.0 -2.0 |
@dcdenu4 or anyone can submit a PR |
This looks to work on master now. Could use a test
|
take |
As mentioned above, the original issue isn't reproducible anymore and there is a test covering this case (
As for I guess this issue can be closed? |
Yeah looks like |
Code Sample, a copy-pastable example if possible
Problem description
Output:
The (second) blank line is not skipped, but instead there is a row with two
NaN
values. It seems thatskip_blank_lines
has no effect onread_fwf
. On the other hand,read_csv(f, sep=' ', header=None)
, produces the expected output below.Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.6.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 79 Stepping 1, GenuineIntel
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.23.1
pytest: 3.6.2
pip: 18.0
setuptools: 39.0.1
Cython: None
numpy: 1.15.1
scipy: None
pyarrow: None
xarray: None
IPython: 6.5.0
sphinx: 1.5.5
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: