Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 用pandas读取excel列_Python_Excel_Pandas - Fatal编程技术网

Python 用pandas读取excel列

Python 用pandas读取excel列,python,excel,pandas,Python,Excel,Pandas,我正在使用Python3 jupyter笔记本和熊猫。我使用以下代码读取excel文件中给定工作表的前两列。我犯了一个错误 tagsFull = pd.read_excel('excelfile.xlsx', sheet_name='Full', names = ['Tag', 'Description'], usecols="A,B") ValueError:“,”不在列表中 如果我写: usecols=["A,B"] usecols=["A","B"] ValueErr

我正在使用Python3 jupyter笔记本和熊猫。我使用以下代码读取excel文件中给定工作表的前两列。我犯了一个错误

tagsFull = pd.read_excel('excelfile.xlsx',
    sheet_name='Full',
    names = ['Tag', 'Description'], usecols="A,B")
ValueError:“,”不在列表中

如果我写:

usecols=["A,B"]
usecols=["A","B"]
ValueError:“,”不在列表中

如果我写:

usecols=["A,B"]
usecols=["A","B"]
ValueError:“B”不在列表中


[编辑]正如jpp指出的,这是一个版本问题。使用parse_cols而不是usecols效果很好。

尝试使用列列表
[“A”,“B”]

试试
usecols=[“A,B”]