-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Closed
Labels
API DesignAlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffClosing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsEnhancement
Description
Feature Type
-
Adding new functionality to pandas
-
Changing existing functionality in pandas
-
Removing existing functionality in pandas
Problem Description
I wish i could write one function which will create view for normalizied data and non-normalized data while calliing thi function.
Feature Description
i see this function in this way
def value_counts_with_normalization(self, subset=None,sort=True, ascending=False, dropna=True,percentage = False):
----
non_normalized_df = self.value_counts(subset = subset
,sort = True,ascending=ascending
,dropna = dropna, normalization = False).reset_index()
normalized_df = self.value_counts(subset = subset,sort = True,ascending=ascending,dropna = dropna, normalization = False).reset_index()
multiplier = 100 if percentage else 1
normalized_df['proportion'] = normalized_df['proportion']*multiplier
return non_normalized_df.merge(normalized_df , on = subset)
Alternative Solutions
I couln't find alternative solution
Additional Context
Example of output

Metadata
Metadata
Assignees
Labels
API DesignAlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffClosing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsEnhancement