'Pandas Dataframe rename

Hello coding friends :),

I'm trying to only rename a specifiy column in my Gold dataframe (pandas) with this command:

BTC = yf.download(tickers='BTC-USD', period="16wk", interval='1d')

SaP = yf.download('SPY', period="16wk", interval="1d")

Gold = yf.download('GC=F', period="16wk", interval="1d")

Gold = Gold.rename(columns={'Open':'Gold'}, inplace=True)

print(type(Gold))

unfortunately the Dataframe type is empty after renaming it, and the type is None althought the column 'Open' is present in the dataframe

What am I missing here?

Does someone know how to do it right?

Thank you all :)

Peter



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source