Skip to content

Scroll output horizontally with large Pandas dataframes #453

@dprada

Description

@dprada

Describe the bug

When a pandas dataframe is wider than the output cell, the result is a dataframe printed out beyond the limits of the web when compiled with sphinx. This happens even with the cell tag "output_scroll":

image

I would have expected a horizontal scroll bar as we can see in the notebook opened with jupyter lab:

image

Is the tag "output_scroll" working only vertically?

Thanks in advance for your help with this issue.

Reproduce the bug

Code to reproduce the behavior:

import pandas as pd
test_dict = {jj*20:[ii] for ii,jj in enumerate('abcdefghijklm')}
pd.DataFrame(test_dict)

The sphinx extensions used are:
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
'sphinx.ext.todo',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.githubpages',
'sphinxcontrib.bibtex',
'sphinx.ext.extlinks',
'sphinx_remove_toctrees',
'sphinx_copybutton',
'myst_nb'
]

List your environment

Versions used:

python: 3.9
sphinx: 5.1.1
myst-nb: 0.16.0
myst-parser: 0.18.0

Theme:
html_theme = 'sphinx_rtd_theme'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions