Answers for "select top values pandas"

2

pandas series select first value

df = pd.DataFrame([[1, 2], [3, 4]], ['a', 'b'], ['A', 'B'])
df['A'].iloc[0]  # first item in a Series (Column)
Posted by: Guest on February-17-2021
-2

pandas top 10 values of a column

df.sort_values(['item', 'value'], ascending=False).groupby('item').head(10)
Posted by: Guest on February-10-2021

Python Answers by Framework

Browse Popular Code Answers by Language