Skip to content

BUG: Cannot assign Series value as None on initial creation of the item #49044

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

Closed
2 of 3 tasks
petebachant opened this issue Oct 11, 2022 · 1 comment
Closed
2 of 3 tasks
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@petebachant
Copy link

petebachant commented Oct 11, 2022

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 numpy as np
import pandas as pd

s = pd.Series(dtype=object)
s["none"] = None
s["nan"] = np.nan

assert s["none"] is None  # Fails

s["none"] = None

assert s["none"] is None  # Passes

Issue Description

Upon initial creation of an item in a Series, None is coerced to NaN, even if dtype=object. After the item exists, it is then possible to set as None.

Expected Behavior

Expect the example above to not raise an exception.

Installed Versions

INSTALLED VERSIONS ------------------ commit : 87cfe4e python : 3.9.13.final.0 python-bits : 64 OS : Linux OS-release : 5.15.68.1-microsoft-standard-WSL2 Version : #1 SMP Mon Sep 19 19:14:52 UTC 2022 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : C.UTF-8 LOCALE : en_US.UTF-8

pandas : 1.5.0
numpy : 1.23.3
pytz : 2022.1
dateutil : 2.8.2
setuptools : 65.4.1
pip : 22.2.2
Cython : None
pytest : 7.1.3
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.0.3
lxml.etree : 4.9.1
html5lib : None
pymysql : 1.0.2
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.5.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : None
brotli :
fastparquet : 0.8.3
fsspec : 2022.8.2
gcsfs : None
matplotlib : 3.6.0
numba : None
numexpr : 2.8.3
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : 6.0.1
pyreadstat : None
pyxlsb : None
s3fs : 0.4.2
scipy : 1.8.1
snappy : None
sqlalchemy : 1.4.41
tables : 3.7.0
tabulate : 0.9.0
xarray : 2022.9.0
xlrd : 2.0.1
xlwt : None
zstandard : None
tzdata : None

@petebachant petebachant added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 11, 2022
@phofl
Copy link
Member

phofl commented Oct 11, 2022

Hi, thanks for your report. Duplicate of #48665

@phofl phofl closed this as completed Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants