Aug-08-2017, 01:10 AM
I get a dataframe to df1 and assign it to df2 to keep a copy.
Not sure why but when df1 is changed, df2 is also changed.
Is there a way to save and keep a copy in a variable without change? Thanks.
Not sure why but when df1 is changed, df2 is also changed.
Is there a way to save and keep a copy in a variable without change? Thanks.
import googlefinance.client as gf param = {'q': 'FB','i': "300",'x': "NASD",'p': "15m"} df1 = gf.get_price_data(param) print('Get dataframe in df1: ') print(df1) df2 = df1 df1['Symbol'] = 'FB' print('\nAfter add column in df1: ') print(df1) print('\nThe column is also added in df2: ') print(df2)