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

use-fstring-for-concatenation can change behaviour in pandas #198

Closed
Hellebore opened this issue Feb 25, 2022 · 1 comment
Closed

use-fstring-for-concatenation can change behaviour in pandas #198

Hellebore opened this issue Feb 25, 2022 · 1 comment
Assignees
Labels
bug Something isn't working next release This will be fixed in next release

Comments

@Hellebore
Copy link
Collaborator

Hellebore commented Feb 25, 2022

Issue description or question

I came across a suggested reformatting with Pandas code that changed the result. The suggestion is "Sourcery - Use f-string instead of string concatenation" on code that looks like this:
df["game_and_track"] = df["game"] + "--" + df["track_title"]
The suggested refactoring changed the operation from broadcasting the string to the shape of the other columns and vectorizing the operation to joining the entirety of each column to the string n times (n=the number of rows).

Sourcery Version

0.10.2

Code editor or IDE name and version

All

OS name and version

All

@Hellebore Hellebore added the bug Something isn't working label Feb 25, 2022
@Hellebore Hellebore self-assigned this Feb 25, 2022
@Hellebore Hellebore added the next release This will be fixed in next release label Feb 26, 2022
@Hellebore
Copy link
Collaborator Author

This is difficult for us to deal with - for the moment am going to disable this refactoring when pandas has been imported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next release This will be fixed in next release
Projects
None yet
Development

No branches or pull requests

1 participant