Reductions
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
Piste de recherche
Commencez par examiner la liste de réductions proposée ainsi que les questions concernant les signatures, la gestion de NA, les axes et l’emplacement de l’API. La tâche serait terminée avec une conception approuvée pour des réductions cohérentes dans les opérations de Series, DataFrame, groupby, window et resample ; l’issue ne nomme aucun fichier d’implémentation ni test.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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

- Langage dominant
- Python
- Étoiles
- 106
- Forks
- 22
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de data-apis/dataframe-api
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
data-apis/dataframe-api#363 · 1 commentaire · 8 réactions ·
-
Row ordering design choiceOuverteAPI design
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
data-apis/dataframe-api#356 · 1 commentaire ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
data-apis/dataframe-api#355 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
data-apis/dataframe-api#352 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
data-apis/dataframe-api#351 ·
Toutes les issues de data-apis/dataframe-api
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Nixtla/mlforecast#823 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
microsoft/ML-For-Beginners#1061 ·
-
bot-found documentation priority: P3
Difficulté 2/5 Moins d'une heure Accessibilité débutants 82/100
madenvel/KalinkaPlayer#503 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 63/100
EleutherAI/lm-evaluation-harness#4508 ·
Les mainteneurs répondent en général sous 1 jour