Reductions
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu bằng việc xem xét danh sách reduction được đề xuất và các câu hỏi về signature, cách xử lý NA, axes và vị trí của API. Hoàn thành sẽ yêu cầu một thiết kế được thống nhất cho các reduction nhất quán trên các operation của Series, DataFrame, groupby, window và resample; issue không nêu tên các file triển khai hoặc test.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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

- Ngôn ngữ chính
- Python
- Star
- 106
- Fork
- 22
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của data-apis/dataframe-api
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
data-apis/dataframe-api#363 · 1 bình luận · 8 reaction ·
-
Row ordering design choiceĐang mởAPI design
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
data-apis/dataframe-api#356 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
data-apis/dataframe-api#355 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
data-apis/dataframe-api#352 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
data-apis/dataframe-api#351 ·
Tất cả issue của data-apis/dataframe-api
Issue tương tự
-
Questions crashes on a real SQuAD2 no-answer predictionCó thể đã có người làm @HuaTNA đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
GST is read as Gulf Standard Time (UTC+4) instead of Guam Standard Time (UTC+10)Có thể đã có người làm @yang00333 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
DOI-USGS/dataretrieval-python#454 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
area:core-platform effort:S priority:P3 status:in-review type:test
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 80/100
randomparity/kdive#3246 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Requantification library converts m/z to mass with the hydrogen-atom mass instead of the proton massĐang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
nf-core/metaboigniter#130 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
netbox status: needs owner type: documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
netbox-community/netbox#23412 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày