I have use the following code to extract column from AZ to CW:
import numpy as np
import pandas as pd
url = 'https://www.dropbox.com/s/yze3laidhv7gl1x/Homework4.xlsx?dl=1'
changedate = lambda x: pd.to_datetime(x, format = "%Y%m")
df = pd.read_excel(url, sheet_name = '49_Industry_Portfolios', header = 6,
parse_cols = 'AZ:CW', index_col = 0, parse_dates = True,
date_parser = changedate, na_values = [-99.99, -999])
print(df)
But it raises a Traceback, anyone could help me to fix this issue? Thanks.
Out:
Traceback (most recent call last):
File "<ipython-input-5-671759d2c7d1>", line 17, in <module>
date_parser = changedate, na_values = [-99.99, -999])
File "/Users/x/anaconda3/lib/python3.6/site-packages/pandas/util/_decorators.py", line 296, in wrapper
return func(*args, **kwargs)
TypeError: read_excel() got an unexpected keyword argument 'parse_cols'