python - ImportError when using read_excel into a data frame -
i encountering importerror when trying use read_excel function of pandas.
i have script works reading csv files , read_csv function, using argparse allow command line arguments. thought i'd try , modify script read excel files.
this code works csv file.
df = pd.read_csv(args.src, header=0, skiprows=datarow, na_values=bad_data, usecols=[timecol, spcol, pvcol, mvcol], names=['timestamp', 'sp', 'pv', 'mv'])
my code allows user select starting row , columns want read data from, , parses them new data frame. works well.
using read_excel function, came this:
df = pd.read_excel(args.src, skiprows=datarow, na_values=bad_data, parse_cols=[timecol, spcol, pvcol, mvcol], header=headerrow)
i removed header argument wasn't required. changed usecols parse_cols per pandas documentation. in read_csv function used custom names column headers, looked read_excel couldn't this. replaced functionality header argument , allowed user set row number in excel source file contained column names.
when ran script, got traceback:
traceback (most recent call last): file "cleanse.py", line 74, in <module> parse_cols=[timecol, spcol, pvcol, mvcol], header=headerrow) file "/usr/local/lib/python2.7/site-packages/pandas/io/excel.py", line 163, in read_excel io = excelfile(io, engine=engine) file "/usr/local/lib/python2.7/site-packages/pandas/io/excel.py", line 187, in __init__ import xlrd # throw importerror if need importerror: no module named xlrd
i saw on post encountering error replied "pip install xlrd", did that. same problem. started dropping off optional arguments 1 @ time. same problem. went right source file argument , still same error.
any hints or advice appreciated.
Comments
Post a Comment