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

False Positive for E712 with np.where #5526

Closed
franneck94 opened this issue Jul 5, 2023 · 1 comment
Closed

False Positive for E712 with np.where #5526

franneck94 opened this issue Jul 5, 2023 · 1 comment
Labels
bug Something isn't working type-inference Requires more advanced type inference.

Comments

@franneck94
Copy link

franneck94 commented Jul 5, 2023

Hi,

i would expect that this is a false positive for the E712 warning with the np.where function on my pandas data frame.
Because using the "is" keyword here, would be a completly different operation.

image

  • A minimal code snippet that reproduces the bug.
import numpy as np
import pandas as pd


df_fl_match_id = pd.DataFrame(index=[i for i in range(10)] + [20], columns=["A"])
fl_non_consecutive_idxs_stop = np.where((np.diff(df_fl_match_id.index) != 1) == True)[0]

print(df_fl_match_id)
print(fl_non_consecutive_idxs_stop)
  • The current Ruff version (ruff --version).
    ruff 0.0.277
@charliermarsh
Copy link
Member

Thanks! We have a tracking issue for this in #4560.

@charliermarsh charliermarsh closed this as not planned Won't fix, can't repro, duplicate, stale Jul 5, 2023
@charliermarsh charliermarsh added type-inference Requires more advanced type inference. bug Something isn't working labels Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working type-inference Requires more advanced type inference.
Projects
None yet
Development

No branches or pull requests

2 participants