diff --git a/doc/source/io.rst b/doc/source/io.rst index bc15aa102dcec..f61eb54888d1c 100644 --- a/doc/source/io.rst +++ b/doc/source/io.rst @@ -1494,7 +1494,8 @@ any pickled pandas object (or any other pickled object) from file: Excel files ----------- -The ``read_excel`` method can read an Excel 2003 file using the ``xlrd`` Python +The ``read_excel`` method can read Excel 2003 (``.xls``) and +Excel 2007 (``.xlsx``) files using the ``xlrd`` Python module and use the same parsing code as the above to convert tabular data into a DataFrame. See the :ref:`cookbook` for some advanced strategies @@ -1516,9 +1517,6 @@ advanced strategies read_excel('path_to_file.xls', 'Sheet1', index_col=None, na_values=['NA']) -To read sheets from an Excel 2007 file, you can pass a filename with a ``.xlsx`` -extension, in which case the ``openpyxl`` module will be used to read the file. - It is often the case that users will insert columns to do temporary computations in Excel and you may not want to read in those columns. `read_excel` takes a `parse_cols` keyword to allow you to specify a subset of columns to parse. diff --git a/pandas/io/excel.py b/pandas/io/excel.py index 03b547fcd47b7..a691075844f8f 100644 --- a/pandas/io/excel.py +++ b/pandas/io/excel.py @@ -37,6 +37,11 @@ def read_excel(path_or_buf, sheetname, kind=None, **kwds): column ranges (e.g. "A:E" or "A,C,E:F") na_values : list-like, default None List of additional strings to recognize as NA/NaN + keep_default_na : bool, default True + If na_values are specified and keep_default_na is False the default NaN + values are overridden, otherwise they're appended to + verbose : boolean, default False + Indicate number of NA values placed in non-numeric columns Returns ------- @@ -101,6 +106,11 @@ def parse(self, sheetname, header=0, skiprows=None, skip_footer=0, column ranges (e.g. "A:E" or "A,C,E:F") na_values : list-like, default None List of additional strings to recognize as NA/NaN + keep_default_na : bool, default True + If na_values are specified and keep_default_na is False the default NaN + values are overridden, otherwise they're appended to + verbose : boolean, default False + Indicate number of NA values placed in non-numeric columns Returns -------