I’m working with a DataFrame and trying to set a multi-level index using two existing columns, and . Here’s my code:
import pandas as pd
# ... (Code to read CSV file)
# Create projection DataFrame
projection = df[['<DATE>', '<TIME>', '<HIGH>']]
# Attempt to set multi-level index
projection.set_index(['<DATE>', '<TIME>'])
print(projection)
The problem is, the index remains unchanged after using set_index. I expect the DataFrame to have a multi-level index with as the first level and as the second.