Skip to content

DOC: read_{csv,excel} skip rows (columns) above (before) header (index columns) #66378

Description

@kuraga
  • I have checked that the issue still exists on the latest versions of the docs on main here.

(Part of #34766.)

test.csv

test.xlsx

Reproducible Example

Issue Description

>>> import pandas as pd

>>> pd.read_csv('test.csv', header=1)
   A2  B2  C2
0  A3  B3  C3
1  A4  B4  C4
2  A5  B5  C5

>>> pd.read_excel('test.xlsx', header=1, engine='openpyxl')
   A2  B2  C2
0  A3  B3  C3
1  A4  B4  C4
2  A5  B5  C5

>>> pd.read_csv('test.csv', header=[1,2])
   A2  B2  C2
   A3  B3  C3
0  A4  B4  C4
1  A5  B5  C5

>>> pd.read_excel('test.xlsx', header=[1,2], engine='openpyxl')
   A2  B2  C2
   A3  B3  C3
0  A4  B4  C4
1  A5  B5  C5

>>> pd.read_csv('test.csv', header=[1,2], index_col=1)
B2  A2  C2
B3  A3  C3
B4  A4  C4
B5  A5  C5

>>> pd.read_excel('test.xlsx', header=[1,2], index_col=1, engine='openpyxl')
B2  A2  C2
B3  A3  C3
B4  A4  C4
B5  A5  C5
  1. Rows above min(header) are ignored.
  2. Columns before min(index_col) are ignored.

Can't see it documented.

Expected Behavior

Don't know.

Installed Versions

Details

INSTALLED VERSIONS

commit : 72f2fea
python : 3.13.14
python-bits : 64
OS : Linux
OS-release : 6.18.33-calculate
Version : #1 SMP PREEMPT_DYNAMIC Tue Jun 9 10:00:56 UTC 2026
machine : x86_64
processor : Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
byteorder : little
LC_ALL : None
LANG : ru_RU.UTF-8
LOCALE : ru_RU.UTF-8

pandas : 3.0.3
numpy : 2.5.1
dateutil : 2.9.0.post0
pip : 26.1.2
Cython : None
sphinx : None
IPython : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.5
psycopg2 : None
pymysql : None
pyarrow : None
pyiceberg : None
pyreadstat : None
pytest : None
python-calamine : None
pytz : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
qtpy : None
pyqt5 : None

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

DocsIO CSVread_csv, to_csvIO Excelread_excel, to_excel

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions