Skip to content

[Python] [LGTM.com] False-positive: py/hash-unhashable-value when indexing pandas.DataFrame with list #2226

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

Open
lagru opened this issue Oct 29, 2019 · 1 comment

Comments

@lagru
Copy link

lagru commented Oct 29, 2019

Description of the false positive

LGTM flagged this snippet

data = data[list(vectors)] 

where data is a pandas.DataFrame as an alert "This instance of list is unhashable." (py/hash-unhashable-value) which I believe is a false positive.

I guess the analysis believes that the list used to index data will be hashed (I can't explain this alert otherwise)? However this is clearly not true as this is simply part of pandas API (see here).

I don't believe this alert was already raised as a false positive in another issue. If I overlooked something I apologize.

URL to the alert on the project page on LGTM.com
https://lgtm.com/projects/gl/tud-mst/ptvpy/snapshot/8523c500d4ec81cb64766e9a57efd801c6ffebe9/files/src/ptvpy/process.py?sort=name&dir=ASC&mode=heatmap#x58400f6141863731:1

@lagru
Copy link
Author

lagru commented Oct 29, 2019

Looking at the query in question it simply seems like pandas.DataFrames are not yet accounted for in the same way numpy.ndarrays are.

@tausbn tausbn self-assigned this Nov 13, 2019
@tausbn tausbn added the Python label Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants