0

I want to show the distribution of the dataframe on a chart, something similar to the box chart, but for the percentile specified by me.

Could someone recommend if there is a way to do that?

Assuming this is the dataframe

df = pd.DataFrame(np.random.randint(1,10,1000),columns=['A']).pct_change().dropna()

np.percentile(df,[25,50,75,100]) will give me the output 

array([-0.5,  0. ,  1. ,  8. ]) 

which is what I want to show in something similar to boxchart any suggestions?

sedavidw
  • 10,038
  • 12
  • 53
  • 88
TRex
  • 355
  • 3
  • 12
  • 1
    `df.boxplot(whis=(0,100))`would draw a boxplot, where the box indicates percentiles 25,50 and 75, and the whiskers percentiles 0 and 100. Similar for `sns.boxplot(data=df, whis=(0,100))`. If you want other percentiles for the box, you can use `plt.bxp()` – JohanC Mar 28 '21 at 23:48
  • thanks @JohanC that was helpful! – TRex Mar 28 '21 at 23:54

0 Answers0