0
df[['High','Symbol']]=df[['High','Symbol']].replace("ethusd", "ETHUSD")

since df[['High', 'Symbol']] creates a new Dataframe why are the changes are being made to the original Dataframe?

it's like-

new_df = original_df["High", "Symbol"]

new_df = new_df.replace("ethusd", "ETHUSD")

Changes made to the original_df, as "ethusd" is replaced by "ETHUSD" in original_df

why are changes applied to the original df if df[['High', 'Symbol']] is a new data frame?

hpaulj
  • 221,503
  • 14
  • 230
  • 353
  • The new dataframe shares the underlying value arrays. It is a `view`, not a copy https://pandas.pydata.org/docs/user_guide/indexing.html#indexing-view-versus-copy – hpaulj Dec 12 '22 at 08:17

0 Answers0