Sort pandas DataFrame by Multiple Columns in Python (Example) | Order Rows | sort_values() Function

Veröffentlicht am: 25 November 2022
auf dem Kanal: Statistics Globe
728
14

How to order the rows of a pandas DataFrame based on multiple columns in the Python programming language. More details: https://statisticsglobe.com/sort-pand...
Python code of this video:

import pandas as pd # Import pandas library in Python

data = pd.DataFrame({'x1':range(0, 8), # Create example DataFrame
'x2':['C', 'A', 'B', 'C', 'A', 'A', 'B', 'A'],
'x3':['a', 'b', 'c', 'b', 'c', 'b', 'a', 'c']})
print(data) # Print example DataFrame

data_new = data.sort_values(['x2', 'x3']) # Sort DataFrame
print(data_new) # Print new DataFrame

Follow me on Social Media:
Facebook – Statistics Globe Page:   / statisticsglobecom  
Facebook – R Programming Group for Discussions & Questions:   / statisticsglobe  
Facebook – Python Programming Group for Discussions & Questions:   / statisticsglobepython  
LinkedIn – Statistics Globe Page:   / statisticsglobe  
LinkedIn – R Programming Group for Discussions & Questions:   / 12555223  
LinkedIn – Python Programming Group for Discussions & Questions:   / 12673534  
Twitter:   / joachimschork  

Music by bensound.com


Auf dieser Seite können Sie das Online-Video Sort pandas DataFrame by Multiple Columns in Python (Example) | Order Rows | sort_values() Function mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Statistics Globe 25 November 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 728 Mal angesehen und es wurde von 14 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!