Created
January 23, 2020 10:34
-
-
Save xoelop/dc7d5f923cbf156dcb157219320272e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
data = pd.Series([1, 4, 4, 6, 2, 4, 7, 4, 7]) | |
# data can be a series or a dataframe | |
# this calculates the inverse quantile for each value of data | |
inverse_quantiles = data.apply(lambda x: ((data <= x).sum()) / len(data)) | |
# read more: https://stackoverflow.com/a/58186830/5031446 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment