BUG: KeyError
when assigning to Series values after pop from DataFrame
#42530
Milestone
KeyError
when assigning to Series values after pop from DataFrame
#42530
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
Throws a
KeyError
:Note that when changing the line
series = df.pop("b")
toseries = df.pop("b").copy()
it works as expected.Expected Output
No exception, first value in
series
set to9
.Output of
pd.show_versions()
INSTALLED VERSIONS
commit : f00ed8f
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.117-58.216.amzn2.x86_64
Version : #1 SMP Tue May 11 20:50:07 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : en_AU.UTF-8
LANG : en_AU.UTF-8
LOCALE : en_AU.UTF-8
pandas : 1.3.0
numpy : 1.21.0
pytz : 2021.1
dateutil : 2.8.1
pip : 21.1.3
setuptools : 49.6.0.post20210108
Cython : None
pytest : 6.2.4
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.9.1 (dt dec pq3 ext lo64)
jinja2 : 3.0.1
IPython : 7.25.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.4.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 4.0.1
pyxlsb : None
s3fs : None
scipy : 1.7.0
sqlalchemy : 1.3.23
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : 0.53.1
The text was updated successfully, but these errors were encountered: