6

I know this is easily done with pandas.io.parser ExcelFile but the documentation says that they are dropping ExcelFile from future versions of pandas so I was wondering how to do this with its replacement read_excel().

The documentation says that you can use a sheet index by doing the following:

read_excel('path_to_file.xls', 0, index_col=None, na_values=['NA'])

Every time I try this I get the following error:

XLRDError: No sheet named <0>
2
  • Which version are you on? Commented Nov 4, 2013 at 2:36
  • I just realized that 0.13 hasn't been released yet. I'm on 0.12 which is why it isn't working. Commented Nov 4, 2013 at 3:16

2 Answers 2

4

I think you're on the wrong version, this feature is new to version 0.13, which hasn't been released just yet.

Sign up to request clarification or add additional context in comments.

1 Comment

Ah, that makes sense. I didn't realize 0.13 hadn't been released yet.
3

The direct answer to your question is that this is a new feature for 0.13. That said, pandas is not planning to remove the ExcelFile class altogether (since you might want to read multiple sheets or be able to introspect sheet names): it was just removed from the pandas.io.parsers namespace to be consistent with the general naming scheme for IO functions (read_clipboard and to_clipboard underwent the same change).

ExcelFile and ExcelWriter will both continue to be available from the toplevel namespace (i.e. from pandas import ExcelFile, ExcelWriter).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.