import pandas as pd import numpy as np df = pd.read_excel("http://kanggc.iptime.org/book/data/sample1-n.xlsx") df.head() print("Data Frame of df is : ",f'\n{df.head()}\n') # yearly time series starting from 2000 to 2016: # df.index = pd.date_range(start='2000', end='2017', freq='Y').year # df.head() # print("Data Frame of df is : ",f'\n{df.head()}\n') year = df['year'] year gdp = df['gdp'] gdp consume = df['consumption'] consume # 자연로그 변수 만들기 lgdp = np.log(gdp) # numpy packaage의 log 활용 lgdp.head() print("Data of log(gdp) is : ",f'\n{lgdp.head()}\n') lconsume = np.log(consume) # numpy packaage의 log 활용 lconsume.head() print("Data of log(consume) is : ",f'\n{lconsume.head()}\n') # 단일 변수명 바꾸기 df_new = df.rename(columns = {'consumption' : 'cons'} ) # consumption을 cons로 수정 df_new # 복수 변수명 바꾸기 df_all = df.rename(columns = {'gdp':'y', 'consumption' : 'c'} ) # gdp 및 consumption을 y 및 c로 수정 df_all