Skip to content

DOC: IPython code blocks without In/Out prompts? #26790

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

We currently use the ipython sphinx directive to run the code examples in our rst docs. This generates output like:

In [3]: s = pd.Series([1, 3, 5, np.nan, 6, 8])

In [4]: s
Out[4]: 
0    1.0
1    3.0
2    5.0
3    NaN
4    6.0
5    8.0
dtype: float64

(first code block from http://pandas.pydata.org/pandas-docs/stable/getting_started/10min.html)

This uses the In [] and Out [] that are characteristic for IPython. But, this also generates quite some "visual clutter" (certainly if the number gets bigger > 10 or > 100).

Assume this would be possible*, what would people think about using plain python-style prompts?
Something like (for the above example)

>>> s = pd.Series([1, 3, 5, np.nan, 6, 8])
>>> s 
0    1.0
1    3.0
2    5.0
3    NaN
4    6.0
5    8.0
dtype: float64

This has less visual clutter IMO (although many people are probably using ipython, so are familiar to the In/Out prompts)

* the IPython sphinx directives allows to customize the input and output prompts, but this currently expects that a number is inserted into it. So the above will not work without adapting the ipython_directive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions