python - How to sort only positive data in Pandas Series that contains negative and zeros -
i have pandas series have negative numbers, zeros , positives numbers. simplest way sort positive entries in descending order , return top 10 sorted result?
np.random.seed(123) s = pd.series(np.random.randint(-100,100,50)) s[s>0].sort_values(ascending=false).head(10) output:
25 95 32 89 39 80 33 76 15 74 47 68 20 64 44 55 17 53 34 35 dtype: int32
Comments
Post a Comment