Skip to content
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

BUG: pd.read_csv(io.StringIO("a\nNone")).a[0] is 'None' on pandas 1 but NaN on pandas 2 #52493

Closed
1 of 3 tasks
graingert opened this issue Apr 6, 2023 · 4 comments
Closed
1 of 3 tasks
Labels
Closing Candidate May be closeable, needs more eyeballs IO CSV read_csv, to_csv

Comments

@graingert
Copy link
Contributor

graingert commented Apr 6, 2023

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
import io

pd.read_csv(io.StringIO("a\nNone")).a[0]

Issue Description

BUG: pd.read_csv(io.StringIO("a\nNone")).a[0] is 'None' on pandas 1 but NaN on pandas 2

Expected Behavior

should be "None"

Installed Versions

INSTALLED VERSIONS

commit : 478d340
python : 3.11.0.final.0
python-bits : 64
OS : Linux
OS-release : 5.19.0-38-generic
Version : #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8

pandas : 2.0.0
numpy : 1.24.2
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 66.1.1
pip : 23.0.1
Cython : None
pytest : 7.2.2
hypothesis : None
sphinx : 5.3.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.2
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.12.0
pandas_datareader: 0.10.0
bs4 : 4.12.1
bottleneck : None
brotli :
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.6.3
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.10.1
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None

@graingert graingert added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 6, 2023
@graingert
Copy link
Contributor Author

this was discovered in bokeh/bokeh#13057

@graingert
Copy link
Contributor Author

looks like this was introduced in #50286

@phofl
Copy link
Member

phofl commented Apr 6, 2023

Yep, confirmed by bisect

b0305f7b8b58c36450ed4b4c285dcf8743c93f42 is the first bad commit
commit b0305f7b8b58c36450ed4b4c285dcf8743c93f42
Author: Patrick Hoefler <61934744+phofl@users.noreply.github.com>
Date:   Tue Dec 27 21:38:15 2022 +0100

    ENH: Add use_nullable_dtypes for read_html (#50286)

This was intentional. You'd have to update the default na values, if you want different behaviour here.
Are the docs sufficient?

@phofl phofl added IO CSV read_csv, to_csv Closing Candidate May be closeable, needs more eyeballs and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 6, 2023
@graingert
Copy link
Contributor Author

Are the docs sufficient?

I now have a fix for bokeh bokeh/bokeh#13069 so I think so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closing Candidate May be closeable, needs more eyeballs IO CSV read_csv, to_csv
Projects
None yet
Development

No branches or pull requests

2 participants