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: Regression in 1.3.0: Exception when setting arrays as cell values #43422

Closed
2 of 3 tasks
felixdivo opened this issue Sep 5, 2021 · 4 comments · Fixed by #43450
Closed
2 of 3 tasks

BUG: Regression in 1.3.0: Exception when setting arrays as cell values #43422

felixdivo opened this issue Sep 5, 2021 · 4 comments · Fixed by #43450
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@felixdivo
Copy link
Contributor

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pandas (yes, on version 1.3.2).
  • (optional) I have confirmed this bug exists on the master branch of pandas.

The following works fine on 1.2.5 and now fails (starting with 1.3.0). I waited for it to be fixed by 1.3.1/1.3.2 but it seems like this one went unnoticed until now.

Code Sample, a copy-pastable example

from pandas import DataFrame
from numpy import zeros

# (Leaving out the dtype doesn't change things)
frame = DataFrame(columns=["x", "P"], dtype=object)
data = {"x": zeros((2, )), "P": zeros((2, 2))}

frame.append(data, ignore_index=True)
frame.loc[0] = data

Problem description

No exception, just the inserted data.

Expected Output

None.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 5f648bf
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-81-generic
Version : #91-Ubuntu SMP Thu Jul 15 19:09:17 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.3.2
numpy : 1.21.0
pytz : 2021.1
dateutil : 2.8.1
pip : 20.0.2
setuptools : 57.0.0
Cython : None
pytest : 6.2.5
hypothesis : 6.17.4
sphinx : 4.0.2
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.1
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.4.2
numexpr : 2.7.3
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.7.1
sqlalchemy : None
tables : 3.6.1
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None

@felixdivo felixdivo added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 5, 2021
@phofl phofl added Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 5, 2021
@phofl phofl added this to the 1.3.3 milestone Sep 5, 2021
@phofl
Copy link
Member

phofl commented Sep 5, 2021

Probably caused by e1dd032 cc @jbrockmendel

@jbrockmendel
Copy link
Member

Looks like this is fixed by moving the elif dtype == object check in can_hold_element up to befor the maybe_infer_dtype_type call. PR to do this would be welcome.

BTW I think the .append in the OP is extraneous

simonjayhawkins added a commit to simonjayhawkins/pandas that referenced this issue Sep 7, 2021
@simonjayhawkins
Copy link
Member

Probably caused by e1dd032

#40709

@felixdivo
Copy link
Contributor Author

Awesomely fast fix! Thank you, @phofl!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants