Skip to content

Commit cc52d9d

Browse files
Merge pull request #6302 from iled/doc
DOC: clarified to_excel and read_excel (GH6260)
2 parents a1cf83e + 9c740f2 commit cc52d9d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

doc/source/io.rst

+9
Original file line numberDiff line numberDiff line change
@@ -1883,6 +1883,15 @@ Files with a ``.xls`` extension will be written using ``xlwt`` and those with a
18831883
``.xlsx`` extension will be written using ``xlsxwriter`` (if available) or
18841884
``openpyxl``.
18851885

1886+
The DataFrame will be written in a way that tries to mimic the REPL output. One
1887+
difference from 0.12.0 is that the ``index_label`` will be placed in the second
1888+
row instead of the first. You can get the previous behaviour by setting the
1889+
``merge_cells`` option in ``to_excel()`` to ``False``:
1890+
1891+
.. code-block:: python
1892+
1893+
df.to_excel('path_to_file.xlsx', index_label='label', merge_cells=False)
1894+
18861895
The Panel class also has a ``to_excel`` instance method,
18871896
which writes each DataFrame in the Panel to a separate sheet.
18881897

pandas/io/excel.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ def read_excel(io, sheetname, **kwds):
8686
convert_float : boolean, default True
8787
convert integral floats to int (i.e., 1.0 --> 1). If False, all numeric
8888
data will be read in as floats: Excel stores all numbers as floats
89-
internally.
89+
internally
90+
has_index_names : boolean, default False
91+
True if the cols defined in index_col have an index name and are
92+
not in the header. Index name will be placed on a separate line below
93+
the header.
9094
9195
Returns
9296
-------

0 commit comments

Comments
 (0)