seaborn: Selected KDE bandwidth is 0. Cannot estimate density

后端 未结 5 776
北恋
北恋 2021-01-04 18:32
import pandas as pd
import seaborn as sns

ser_test = pd.Series([1,0,1,4,6,0,6,5,1,3,2,5,1])
sns.kdeplot(ser_test, cumulative=True)

The above code g

5条回答
  •  佛祖请我去吃肉
    2021-01-04 18:53

    you have three options to try

    first: showing KDE lumps with the default settings

    sns.distplot(ser_test, hist = False, rug = True, rug_kws = {'color' : 'r'})

    second: KDE with narrow bandwidth to show individual probability lumps

    sns.distplot(ser_test, hist = False, rug = True, rug_kws = {'color' : 'r'}, kde_kws = {'bw' : 1})

    third: choosing a different, triangular kernel function (lump shape)

    sns.distplot(ser_test, hist = False, rug = True, rug_kws = {'color' : 'r'}, kde_kws = {'bw' : 1.5, 'kernel' : 'tri'})

提交回复
热议问题