AP360
AP360

Reputation: 1

Converting yfinance dataframe into multi-index dataframe

Trying to convert this dataframe(df_long) into a multi-index dataframe (df_wide)

Imported this data from yfinance. New to python so would really appreciate the help :)

enter image description here

Upvotes: 0

Views: 278

Answers (1)

Seyed_Ali_Mohtarami
Seyed_Ali_Mohtarami

Reputation: 1164

To get rid of the multi-index, use .reset_index():

df_long.pivot_table(index=["Data"], 
                columns='tickers', 
                values='grade').reset_index()

pandas.DataFrame.reset_index

Upvotes: 1

Related Questions