Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- df = pd.DataFrame({'uno': [1, 2, 3], 'dos': [4, 5, 6], 'tres': [7, 8, 9]}, index=['x', 'y', 'z'])
- print(df)
- print()
- # Orden por índice (fila):
- print(df.sort_index())
- print()
- # Ordenar por índice (columna):
- print(df.sort_index(axis=1, ascending=False))
- print()
- # Ordenar por los valores de la columna 'tres':
- print(df.sort_values(by='tres', ascending=False))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement