Skip to content

Commit 2164c75

Browse files
committed
Regenerate html
1 parent e05b8ca commit 2164c75

File tree

2 files changed

+89
-87
lines changed

2 files changed

+89
-87
lines changed

pandas/guide/_sources/pandas_docstring.rst.txt

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ docstrings, but is it common to have inline code, which is presented between
101101
backticks. It is considered inline code:
102102

103103
- The name of a parameter
104-
- Python code, a module, function, built-in, type, literal... (e.g. `os`, `list`, `numpy.abs`, `datetime.date`, `True`)
104+
- Python code, a module, function, built-in, type, literal... (e.g. ``os``,
105+
``list``, ``numpy.abs``, ``datetime.date``, ``True``)
105106
- A pandas class (in the form ``:class:`~pandas.Series```)
106107
- A pandas method (in the form ``:meth:`pandas.Series.sum```)
107108
- A pandas function (in the form ``:func:`pandas.to_datetime```)
@@ -149,8 +150,8 @@ backticks. It is considered inline code:
149150
Section 1: Short summary
150151
~~~~~~~~~~~~~~~~~~~~~~~~
151152

152-
The short summary is a single sentence that express what the function does in a
153-
concise way.
153+
The short summary is a single sentence that expresses what the function does in
154+
a concise way.
154155

155156
The short summary must start with a capital letter, end with a dot, and fit in
156157
a single line. It needs to express what the object does without providing
@@ -395,7 +396,7 @@ last two types, that need to be separated by the word 'or':
395396
- float, decimal.Decimal or None
396397
- str or list of str
397398

398-
If `None` is one of the accepted values, it always needs to be the last in
399+
If ``None`` is one of the accepted values, it always needs to be the last in
399400
the list.
400401

401402
.. _docstring.returns:
@@ -493,28 +494,28 @@ instead of at the beginning, it is good to let the users know about it.
493494
To give an intuition on what can be considered related, here there are some
494495
examples:
495496

496-
* `loc` and `iloc`, as they do the same, but in one case providing indices and
497-
in the other positions
498-
* `max` and `min`, as they do the opposite
499-
* `iterrows`, `itertuples` and `iteritems`, as it is easy that a user looking
500-
for the method to iterate over columns ends up in the method to iterate
501-
over rows, and vice-versa
502-
* `fillna` and `dropna`, as both methods are used to handle missing values
503-
* `read_csv` and `to_csv`, as they are complementary
504-
* `merge` and `join`, as one is a generalization of the other
505-
* `astype` and `pandas.to_datetime`, as users may be reading the documentation
506-
of `astype` to know how to cast as a date, and the way to do it is with
507-
`pandas.to_datetime`
508-
* `where` is related to `numpy.where`, as its functionality is based on it
497+
* ``loc`` and ``iloc``, as they do the same, but in one case providing indices
498+
and in the other positions
499+
* ``max`` and ``min``, as they do the opposite
500+
* ``iterrows``, ``itertuples`` and ``iteritems``, as it is easy that a user
501+
looking for the method to iterate over columns ends up in the method to
502+
iterate over rows, and vice-versa
503+
* ``fillna`` and ``dropna``, as both methods are used to handle missing values
504+
* ``read_csv`` and ``to_csv``, as they are complementary
505+
* ``merge`` and ``join``, as one is a generalization of the other
506+
* ``astype`` and ``pandas.to_datetime``, as users may be reading the
507+
documentation of ``astype`` to know how to cast as a date, and the way to do
508+
it is with ``pandas.to_datetime``
509+
* ``where`` is related to ``numpy.where``, as its functionality is based on it
509510

510511
When deciding what is related, you should mainly use your common sense and
511512
think about what can be useful for the users reading the documentation,
512513
especially the less experienced ones.
513514

514-
When relating to other libraries (mainly `numpy`), use the name of the module
515-
first (not an alias like `np`). If the function is in a module which is not
516-
the main one, like `scipy.sparse`, list the full module (e.g.
517-
`scipy.sparse.coo_matrix`).
515+
When relating to other libraries (mainly ``numpy``), use the name of the module
516+
first (not an alias like ``np``). If the function is in a module which is not
517+
the main one, like ``scipy.sparse``, list the full module (e.g.
518+
``scipy.sparse.coo_matrix``).
518519

519520
This section, as the previous, also has a header, "See Also" (note the capital
520521
S and A). Also followed by the line with hyphens, and preceded by a blank line.
@@ -579,8 +580,8 @@ placed in the last position. As often, people understand concepts better
579580
with examples, than with accurate explanations.
580581

581582
Examples in docstrings, besides illustrating the usage of the function or
582-
method, they must be valid Python code, that in a deterministic way returns
583-
the presented output, and that can be copied and run by users.
583+
method, must be valid Python code, that in a deterministic way returns the
584+
presented output, and that can be copied and run by users.
584585

585586
They are presented as a session in the Python terminal. `>>>` is used to
586587
present code. `...` is used for code continuing from the previous line.
@@ -590,7 +591,7 @@ be added with blank lines before and after them.
590591

591592
The way to present examples is as follows:
592593

593-
1. Import required libraries (except `numpy` and `pandas`)
594+
1. Import required libraries (except ``numpy`` and ``pandas``)
594595

595596
2. Create the data required for the example
596597

@@ -649,7 +650,7 @@ A simple example could be:
649650
650651
The examples should be as concise as possible. In cases where the complexity of
651652
the function requires long examples, is recommended to use blocks with headers
652-
in bold. Use double star \*\* to make a text bold, like in \*\*this example\*\*.
653+
in bold. Use double star ``**`` to make a text bold, like in ``**this example**``.
653654

654655
.. _docstring.example_conventions:
655656

@@ -671,28 +672,29 @@ and avoiding aliases. Avoid excessive imports, but if needed, imports from
671672
the standard library go first, followed by third-party libraries (like
672673
matplotlib).
673674

674-
When illustrating examples with a single `Series` use the name `s`, and if
675-
illustrating with a single `DataFrame` use the name `df`. For indices, `idx`
676-
is the preferred name. If a set of homogeneous `Series` or `DataFrame` is used,
677-
name them `s1`, `s2`, `s3`... or `df1`, `df2`, `df3`... If the data is not
678-
homogeneous, and more than one structure is needed, name them with something
679-
meaningful, for example `df_main` and `df_to_join`.
675+
When illustrating examples with a single ``Series`` use the name ``s``, and if
676+
illustrating with a single ``DataFrame`` use the name ``df``. For indices,
677+
``idx`` is the preferred name. If a set of homogeneous ``Series`` or
678+
``DataFrame`` is used, name them ``s1``, ``s2``, ``s3``... or ``df1``,
679+
``df2``, ``df3``... If the data is not homogeneous, and more than one structure
680+
is needed, name them with something meaningful, for example ``df_main`` and
681+
``df_to_join``.
680682

681683
Data used in the example should be as compact as possible. The number of rows
682684
is recommended to be around 4, but make it a number that makes sense for the
683-
specific example. For example in the `head` method, it requires to be higher
684-
than 5, to show the example with the default values. If doing the `mean`,
685-
we could use something like `[1, 2, 3]`, so it is easy to see that the
686-
value returned is the mean.
685+
specific example. For example in the ``head`` method, it requires to be higher
686+
than 5, to show the example with the default values. If doing the ``mean``, we
687+
could use something like ``[1, 2, 3]``, so it is easy to see that the value
688+
returned is the mean.
687689

688690
For more complex examples (groupping for example), avoid using data without
689691
interpretation, like a matrix of random numbers with columns A, B, C, D...
690692
And instead use a meaningful example, which makes it easier to understand the
691693
concept. Unless required by the example, use names of animals, to keep examples
692694
consistent. And numerical properties of them.
693695

694-
When calling the method, keywords arguments `head(n=3)` are preferred to
695-
positional arguments `head(3)`.
696+
When calling the method, keywords arguments ``head(n=3)`` are preferred to
697+
positional arguments ``head(3)``.
696698

697699
**Good:**
698700

@@ -827,15 +829,13 @@ Getting the examples pass the doctests in the validation script can sometimes
827829
be tricky. Here are some attention points:
828830

829831
* Import all needed libraries (except for pandas and numpy, those are already
830-
imported as `import pandas as pd` and `import numpy as np`) and define all
831-
variables you use in the example.
832+
imported as ``import pandas as pd`` and ``import numpy as np``) and define
833+
all variables you use in the example.
832834

833835
* Try to avoid using random data.
834836

835837
* If you have a code snippet that wraps multiple lines, you need to use '...'
836-
on the continued lines:
837-
838-
::
838+
on the continued lines: ::
839839

840840
>>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], index=['a', 'b', 'c'],
841841
... columns=['A', 'B'])
@@ -853,12 +853,12 @@ be tricky. Here are some attention points:
853853
represenation), you can use ``...`` to represent this part.
854854

855855
If you want to show that ``s.plot()`` returns a matplotlib AxesSubplot object,
856-
this will fail the doctest::
856+
this will fail the doctest ::
857857

858858
>>> s.plot()
859859
<matplotlib.axes._subplots.AxesSubplot at 0x7efd0c0b0690>
860860

861-
However, you can do (notice the comment that needs to be added)::
861+
However, you can do (notice the comment that needs to be added) ::
862862

863863
>>> s.plot() # doctest: +ELLIPSIS
864864
<matplotlib.axes._subplots.AxesSubplot at ...>
@@ -870,7 +870,7 @@ Plots in examples
870870
^^^^^^^^^^^^^^^^^
871871

872872
There are some methods in pandas returning plots. To render the plots generated
873-
by the examples in the documentation, the `.. plot::` directive exists.
873+
by the examples in the documentation, the ``.. plot::`` directive exists.
874874

875875
To use it, place the next code after the "Examples" header as shown below. The
876876
plot will be generated automatically when building the documentation.

0 commit comments

Comments
 (0)