Example data: a = [68, 63, 20, 55, 1, 21, 55, 58, 14, 4, 40, 54, 33, 71, 36, 38, 9, 51, 89, 40, 13, 98, 46, 12, 21, 26, 40, 59, 17, 0, 5, 25, 19, 49, 91, 55, 39, 82, 57, 28, 54, 58, 65, 2, 39, 42, 65, 1, 93, 8, 26, 69, 88, 32, 15, 10, 95, 11, 2, 44, 66, 98, 18, 21, 25, 17, 41, 74, 12, 4, 33, 93, 65, 33, 25, 76, 84, 1, 63, 74, 3, 39, 9, 40, 7, 81, 55, 78, 7, 5, 99, 37, 7, 82, 54, 16, 22, 24, 23, 3] Its KDE looks like this: to produce this kdeplot: import matplotlib.pyplot as plt import seaborn as sns fig = plt.figure(figsize=(12, 6)) ax = sns.kdeplot(a, bw_adjust=0.5, fill=True, cut=0) ax.set_xticks(np.arange(0, 100, 5)) I want to get the highest 2 peaks in the KDE plot. The 1st one is between 5 and 10, and the other one is between 35 and 40. However, I tried tuning all the parameters in scipy.signal.find_peaks, the results are not what I thought. Is there any robust and automatic method in Python to achieve this? Please show exmaple codes, thanks. Continue reading...