github / github/codeql

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

オープン
#2,226 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
false-positive Python
主要言語
CodeQL
スター
10.1k
フォーク
2.1k
平均マージ
2日 15時間
マージ済み PR(30日)
141

説明

**Description of the false positive**

LGTM flagged this snippet

```python
data = data[list(vectors)]
```
where `data` is a [pandas.DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/frame.html) 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](https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#different-choices-for-indexing)).

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。