3

Seems like this has an answer here and here already, however, none of these solutions are working for me.

I'm trying to do

xls = pd.ExcelFile('input.xls')
df = pd.read_excel(xls, sheet_name="Sheet2") ## Also tried sheet_name = 1

No matter what, df in the end still contains the first sheet instead of the second. I'm on Python 3 and Pandas 0.20.1 (Anaconda distro). What am I missing? How can I load the second sheet into df?

lte__
  • 6,325
  • 16
  • 66
  • 122

1 Answers1

3

from the docs:

sheetname : string, int, mixed list of strings/ints, or None, default 0

Deprecated since version 0.21.0: Use sheet_name instead

That also means that it used to be sheetname before the version 0.21.0 ;-)

MaxU - stop genocide of UA
  • 191,778
  • 30
  • 340
  • 375