filmov
tv
Sort Index of pandas DataFrame in Python (Example) | sort_index & reset_index Functions | Row Order

Показать описание
Python code of this video:
import pandas as pd # Import pandas library to Python
data = pd.DataFrame({'x1':range(10, 20), # Create pandas DataFrame
'x2':['a', 'b', 'c', 'd', 'e', 'e', 'd', 'c', 'b', 'a'],
'x3':range(10, 0, - 1)},
index = [5, 1, 9, 4, 8, 7, 0, 6, 2, 3])
print(data) # Print pandas DataFrame
print(data_new1) # Print updated DataFrame
print(data_new2) # Print updated DataFrame
Follow me on Social Media:
import pandas as pd # Import pandas library to Python
data = pd.DataFrame({'x1':range(10, 20), # Create pandas DataFrame
'x2':['a', 'b', 'c', 'd', 'e', 'e', 'd', 'c', 'b', 'a'],
'x3':range(10, 0, - 1)},
index = [5, 1, 9, 4, 8, 7, 0, 6, 2, 3])
print(data) # Print pandas DataFrame
print(data_new1) # Print updated DataFrame
print(data_new2) # Print updated DataFrame
Follow me on Social Media: