Running mypy on script with pd.pivot_table gets exponentially slower with more columns
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- numpy, pandas, python
- 領域
- devtools, performance
調査の方向性
まず、提供された Python 再現プログラムを mypy 1.7.0 で実行し、選択する列が増えるにつれて実行時間を比較します。型チェックの経路をプロファイリングして増加の原因を特定します。大きい方の列セットで、動作を変更せずに再現プログラムが 1 秒未満で完了すれば完了とします。
索引モデルが issue の本文から書いたものです。
説明
Bug Report
When running mypy on a script containing pd.pivot_table, the amount of time for mypy to finish grows exponentially with the number of columns selected and aggregated in the table.
To Reproduce
from string import ascii_letters
import numpy as np
import pandas as pd
df = pd.DataFrame({letter: [1, 2, 3] for letter in ascii_letters[:14]})
df2 = pd.pivot_table(
df,
values=["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"],
columns=["a"],
aggfunc={
"a": np.sum,
"b": np.sum,
"c": np.sum,
"d": np.sum,
"e": np.sum,
"f": np.sum,
"g": np.sum,
"h": np.sum,
"i": np.sum,
"j": np.sum,
"k": np.sum,
"l": np.sum,
"m": np.sum,
"n": np.sum,
},
)
Expected Behavior
It should finish in <1s, like it does if there are fewer columns
Actual Behavior
Takes 200 seconds to run mypy on this script
Your Environment
- Mypy version used: 1.7.0
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini(and other config files): None - Python version used: 3.8.15
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 54
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python/mypy のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug topic-configuration topic-error-reporting
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
bancolombia/sentinel#23 ·
-
test md オープンCI
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
langchain-ai/deepagents#6450 ·
-
bug client
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100