pydit.statistics.percentile.add_percentile¶
- pydit.statistics.percentile.add_percentile(df, col, col_group=None)[source]¶
Adds columns for percentile for a chosen column in a DataFrame
It can also provide it within a category group (col_group)
- Parameters:
df (DataFrame) – A pandas Dataframe object
col (str) – The column to calculate the percentile for
col_group (list, optional, default None) – The column to group by, by default None
Also (See)
---------
https (//stackoverflow.com/questions/50804120/how-do-i-get-the-percentile-for-a-row-in-a-pandas-dataframe)
method (Using the percentile with linear interpolation)
various (but kept)
reference. (ranks calculations for)
reference/debugging (These are alternative ways of calculating for)
df[col].rank(method="max" (df["PCNT_RANK"] =)
pct=True)
x (df["CHK"] = df["PCNT_LIN"].apply(lambda)
x
x
suite (You can check these methods in action in the test)
- Returns:
Returns a copy of the dataframe with the new columns added.
- Return type:
pandas.DataFrame