"I want to make column ID the index but I get a error. What am I doing wrong? I will appreciate any help"
# importing pandas as pd
import pandas as pd
# Creating the dataframe
df = pd.DataFrame({"A": [1, 5, 3, 4, 2],
"B": [3, 2, 5, 3, 4],
"C": [2, 2, 7, 3, 4],
"D": [4, 3, 6, 12, 7],
"ID": [1 , 2 , 3 , 4 , 5]})
# Print the dataframe
print(df)
# Output
# A B C D ID
# 0 1 3 2 4 1
# 1 5 2 2 3 2
# 2 3 5 7 6 3
# 3 4 3 3 12 4
# 4 2 4 4 7 5
#
# reindexing = make column ID the new index values
df.reindex("ID")