Skip to content

Conversation

@phofl
Copy link
Member

@phofl phofl commented Feb 6, 2023

@phofl phofl added the Indexing Related to indexing on series/frames, not to indexes themselves label Feb 6, 2023
@mroeschke mroeschke added this to the 2.0 milestone Feb 6, 2023
@mroeschke mroeschke merged commit eec200d into pandas-dev:main Feb 6, 2023
@mroeschke
Copy link
Member

Thanks @phofl

@phofl phofl deleted the 45981 branch February 6, 2023 19:55
@sam-infinity
Copy link

I have some code that broke between version 1.4.4 and 1.5.0. I was wondering if this merge will fix it. The code is essentially doing:

import pandas as pd

df = pd.DataFrame({
    "A": [],
    "B": []
}).astype('str')

df.loc[df['A'].str.contains('STUFF'), ['A']] = df['A'] + '-' + df['B']

In 1.4.4 it is a no-op but in 1.5.0 it fails with ValueError: shape mismatch: value array of shape (0,) could not be broadcast to indexing result of shape (0,1).

@phofl
Copy link
Member Author

phofl commented Feb 16, 2023

You can check your code on our nightly builds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Indexing Related to indexing on series/frames, not to indexes themselves

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: loc.setitem casting dtype to float with all false Indexer and rhs is an empty list

3 participants