Skip to content

Pandas - Repeat headings every n-th row in Jupyter-lab notebook #27563

Closed
@Code4SAFrankie

Description

@Code4SAFrankie

Code Sample, a copy-pastable example if possible

pd.set_option('display.max_columns', None)
df.head(30)

Problem description

Is there a way to repeat the headings (column titles) of a Pandas dataframe every n-th row in a Jupyter-lab notebook.

I normally use pd.set_option('display.max_columns', None) with pandas in a Jupyter-lab notebook, since I want to view all the columns and data. However when showing more than 10 rows the scroll bar at the bottom is hidden when viewing the headings and the headings are hidden when viewing the scroll bar; which makes it very difficult to know what you are seeing or to know where to scroll to.

Is there a way to repeat the headings every n-th row or is it possible to have a vertical scrollbar as well with the headings then always remaining visible.

Expected Output

Headings and scrollbar visible at the same time.

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]
commit: None
python: 3.7.1.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.24.2
pytest: 4.0.0
pip: 19.2.1
setuptools: 40.6.2
Cython: 0.29
numpy: 1.16.2
scipy: 1.2.1
pyarrow: 0.11.1
xarray: 0.10.9
IPython: 7.1.1
sphinx: 1.8.1
patsy: 0.5.1
dateutil: 2.7.5
pytz: 2018.6
blosc: 1.6.1
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.8
feather: 0.4.0
matplotlib: 3.0.2
openpyxl: None
xlrd: 1.1.0
xlwt: None
xlsxwriter: 1.1.2
lxml.etree: 4.2.5
bs4: 4.6.3
html5lib: 1.0.1
sqlalchemy: 1.2.12
pymysql: None
psycopg2: 2.7.7 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
fastparquet: 0.1.6
pandas_gbq: None
pandas_datareader: 0.7.0
gcsfs: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIO HTMLread_html, to_html, Styler.apply, Styler.applymap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions