Open lendle opened 1 year ago
I think the change is due to this pr https://github.com/pandas-dev/pandas/pull/52906. Not sure what the expected behavior is but it probably shouldn't depend on whether a value exists at that index yet or not.
I am seeing this issue from pandas 2.0.2 [2.0.2 and 2.0.3]. I verified that the behavior was as expected in pandas 2.0.0 as well as 2.0.1
Pandas 2.1.1 is still affected. :frowning_face:
Pandas 2.2.2 is still affected. ☹️
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] 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
Issue Description
When reassigning a value to an index in a series, if the value is a numpy array with a single element, the dimension of the array is lost. When assigning to an index that does not exist, the array retains it's shape
(1,)
Expected Behavior
The array's shape shouldn't depend on whether the index already exists in the series or not. This was the behavior in pandas 2.0.0.
Installed Versions