Reductions
まだ誰も着手していません。
評価
調査の方向性
まず、提案されている削減リストと、シグネチャ、NA の扱い、軸、API の配置に関する質問を確認します。完了には、Series、DataFrame、groupby、window、resample の各操作で一貫した削減を実現するための合意済みの設計が必要です。この issue では実装ファイルやテストは指定されていません。
索引モデルが issue の本文から書いたものです。
説明
Next are listed the reductions over numerical types defined in pandas. These can be applied:
- To
Series - To N columns of a
DataFrame - To group by operations
- As window functions (window, rolling, expanding or ewm)
- In resample operations
pandas is not consistent, in letting any reduction to be applied to any of the above. Each method is
independent (Series.sum, GroupBy.sum, Window.sum...). Some reductions are not implemented for
some of the classes. And the signatures can change (e.g. Series.var(ddof) vs EWM.var(bias))
I propose to have standard signatures for the reductions, and have all reductions available to all classes.
Reductions for numerical data types and proposed signatures
all()any()count()nunique()# may be the name could becount_unique,count_distinct...?mode()# what to do if there is more than one mode? Ideally we would like all reductions to return a scalarmin()max()median()quantile(q, interpolation='linear')# in pandasqis by default0.5, but I think it's better to require it; interpolation can be {‘linear’, ‘lower’, ‘higher’, ‘midpoint’, ‘nearest’}sum()prod()mean()var(ddof=1)# delta degrees of freedom (for some classesbiasis used)std(ddof=1)skew()kurt()# pandas has also the aliaskurtosissem(ddof=1)# standard error of the meanmad()# mean absolute deviationautocorr(lag=1)is_unique()# in pandas is a propertyis_monotonic()# in pandas is a propertyis_monotonic_decreasing()# in pandas is a propertyis_monotonic_increasing()# in pandas is a property
Reductions that may depend on row labels (and could potentially return a list, like mode):
idxmax()/argmax()idxmin()/argmin()
These need an extra column other:
cov(other, ddof=1)corr(other, method='pearson')# method can be {‘pearson’, ‘kendall’, ‘spearman’}
Questions
- Allow reductions over rows, or only over columns?
- What to do with NA?
- pandas has parameters (
bool_only,numeric_only) to let only apply the operation over columns of certain types only. Do we want it?- I think something like
df.select_columns_by_dtype(int).sum()would be preferrable than a parameter to all or some reductions
- I think something like
- pandas has a
levelparameter in many reductions, for MultiIndex. If Indexing/MultiIndexing is part of the API, do we want to have it? - pandas has a
min_count/min_periodsparameter in some reductions (e.g.sum,min), to returnNAif less thanmin_countvalues are present. Do we want to keep it? - How should reductions be applied?
- In the top-level namespace, as pandas (e.g.
df[col].sum()) - Using an accessor (e.g.
df[col].reduce.sum()) - Having a
reducefunction, and passing the specific functions as a parameter (e.g.df[col].reduce(sum)) - Other ideas
- In the top-level namespace, as pandas (e.g.
- Would it make sense to have a third-party package implementing reductions that can be reused by projects?
Frequency of usage

- 主要言語
- Python
- スター
- 106
- フォーク
- 22
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
data-apis/dataframe-api のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
data-apis/dataframe-api#363 · コメント 1 件 · リアクション 8 件 ·
-
API design
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
data-apis/dataframe-api#356 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
data-apis/dataframe-api#355 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
data-apis/dataframe-api#352 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
data-apis/dataframe-api#351 ·
data-apis/dataframe-api の issue をすべて見る
似ている issue
-
Path subtraction removes repeated suffix characters instead of one suffix対応中かも @Gwerdonatus が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
joke2k/django-environ#671 ·
-
good first issue help wanted windows
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
-
test_pgbouncer deploys the server under test from Charmhub instead of the local build (track/1.31)オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
canonical/temporal-k8s-operator#195 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
`burr` fails to start when the Python path has a space in it対応中かも @enekoreto が今日担当しました。 オープンstatus/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 5 日以内に返信
-
device support request
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
zigpy/zha-device-handlers#5461 ·
メンテナーはふだん 4 日以内に返信