Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- df = pd.DateFrame(people)
- print(df.sort_values(by=['last', 'first'], ascending = [False, True]).reset_index(drop = True))
- # OR (they are equal)
- print(df.sort_values(by=['last', 'first'], ascending = [False, True], ignore_index = True))
- ############################################
- mpg.sort_values(ascending = False, inplace = True)
- mpg.sort_index(inplace = True)
- ############################################
- titanic.nlargest(n = 5, columns = 'fare')
- titanic.nsmallest(n = 5, columns = 'fare')
- cars.nlargest(n = 10, columns = "weight")
- ############################################
- top_20_percent = df.nlargest(int(len(df) * 0.2), columns='column_name')
- ############################################
- titanic.loc[titanic.age.idxmin()]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement