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: wrong item assignment by repeated key with ArrowExtensionArray #58530

Closed
3 tasks done
hombit opened this issue May 2, 2024 · 0 comments · Fixed by #58616
Closed
3 tasks done

BUG: wrong item assignment by repeated key with ArrowExtensionArray #58530

hombit opened this issue May 2, 2024 · 0 comments · Fixed by #58616
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@hombit
Copy link
Contributor

hombit commented May 2, 2024

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 pyarrow as pa

series = pd.Series([0,1,2,3,4,5], dtype=pd.ArrowDtype(pa.int64()))
series[[0, 0, 1]] = [-1, -1, -2]

pd.testing.assert_series_equal(
    series,  # [-1, -1, 2, 3, 4, 5]
    pd.Series([-1, -2, 2, 3, 4, 5], dtype=pd.ArrowDtype(pa.int64())),
)

Issue Description

With series backed by ArrowExtensionArray, assignment with a non-unique key causes incorrect results.

Expected Behavior

Assignment works like in numpy

Installed Versions

INSTALLED VERSIONS

commit : d9cdd2e
python : 3.12.3.final.0
python-bits : 64
OS : Darwin
OS-release : 23.4.0
Version : Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020
machine : arm64
processor : arm
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 2.2.2
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.9.0.post0
setuptools : None
pip : 24.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 8.23.0
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.8.4
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 16.0.0
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.13.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2024.1
qtpy : None
pyqt5 : None

@hombit hombit added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels May 2, 2024
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

Successfully merging a pull request may close this issue.

1 participant