Skip to content

Commit f5b5b19

Browse files
authored
DOCS: Add comment about index_col and forward filling missing values (#45989)
1 parent 0631637 commit f5b5b19

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

doc/source/user_guide/io.rst

+4
Original file line numberDiff line numberDiff line change
@@ -3675,6 +3675,10 @@ should be passed to ``index_col`` and ``header``:
36753675
36763676
os.remove("path_to_file.xlsx")
36773677
3678+
Missing values in columns specified in ``index_col`` will be forward filled to
3679+
allow roundtripping with ``to_excel`` for ``merged_cells=True``. To avoid forward
3680+
filling the missing values use ``set_index`` after reading the data instead of
3681+
``index_col``.
36783682

36793683
Parsing specific columns
36803684
++++++++++++++++++++++++

pandas/io/excel/_base.py

+5
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@
119119
those columns will be combined into a ``MultiIndex``. If a
120120
subset of data is selected with ``usecols``, index_col
121121
is based on the subset.
122+
123+
Missing values will be forward filled to allow roundtripping with
124+
``to_excel`` for ``merged_cells=True``. To avoid forward filling the
125+
missing values use ``set_index`` after reading the data instead of
126+
``index_col``.
122127
usecols : str, list-like, or callable, default None
123128
* If None, then parse all columns.
124129
* If str, then indicates comma separated list of Excel column letters

0 commit comments

Comments
 (0)