Plotting CDF of a pandas series in python

后端 未结 7 1096
情话喂你
情话喂你 2020-12-23 09:25

Is there a way to do this? I cannot seem an easy way to interface pandas series with plotting a CDF.

7条回答
  •  隐瞒了意图╮
    2020-12-23 09:57

    I found another solution in "pure" Pandas, that does not require specifying the number of bins to use in a histogram:

    import pandas as pd
    import numpy as np # used only to create example data
    
    series = pd.Series(np.random.normal(size=10000))
    
    cdf = series.value_counts().sort_index().cumsum()
    cdf.plot()
    

提交回复
热议问题