Skip to content

Replace single with double backticks in RST file #36617 #36632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Sep 26, 2020
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,35 @@ repos:
- id: rst-backticks
# these exclusions should be removed and the files fixed
exclude: (?x)(
categorical\.rst|
contributing\.rst|
contributing_docstring\.rst|
extending\.rst|
ecosystem\.rst|
comparison_with_sql\.rst|
install\.rst|
calculate_statistics\.rst|
combine_dataframes\.rst|
v0\.|
v1\.0\.|
v1\.1\.[012])
text\.rst|
timeseries\.rst|
visualization\.rst|
missing_data\.rst|
options\.rst|
reshaping\.rst|
scale\.rst|
merging\.rst|
cookbook\.rst|
enhancingperf\.rst|
groupby\.rst|
io\.rst|
overview\.rst|
panel\.rst|
plotting\.rst|
10min\.rst|
basics\.rst|
categorical\.rst|
contributing\.rst|
contributing_docstring\.rst|
extending\.rst|
ecosystem\.rst|
comparison_with_sql\.rst|
install\.rst|
calculate_statistics\.rst|
combine_dataframes\.rst|
v0\.|
v1\.0\.|
v1\.1\.[012])
- repo: local
hooks:
- id: pip_to_conda
Expand Down
20 changes: 10 additions & 10 deletions doc/source/development/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ comment letting others know they are working on an issue. While this is ok, you
check each issue individually, and it's not possible to find the unassigned ones.

For this reason, we implemented a workaround consisting of adding a comment with the exact
text `take`. When you do it, a GitHub action will automatically assign you the issue
text ``take``. When you do it, a GitHub action will automatically assign you the issue
(this will take seconds, and may require refreshing the page to see it).
By doing this, it's possible to filter the list of issues and find only the unassigned ones.

So, a good way to find an issue to start contributing to pandas is to check the list of
`unassigned good first issues <https://github.com/pandas-dev/pandas/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+no%3Aassignee>`_
and assign yourself one you like by writing a comment with the exact text `take`.
and assign yourself one you like by writing a comment with the exact text ``take``.

If for whatever reason you are not able to continue working with the issue, please try to
unassign it, so other people know it's available again. You can check the list of
Expand Down Expand Up @@ -133,7 +133,7 @@ want to clone your fork to your machine::
cd pandas-yourname
git remote add upstream https://github.com/pandas-dev/pandas.git

This creates the directory `pandas-yourname` and connects your repository to
This creates the directory ``pandas-yourname`` and connects your repository to
the upstream (main project) *pandas* repository.

Note that performing a shallow clone (with ``--depth==N``, for some ``N`` greater
Expand All @@ -155,12 +155,12 @@ Using a Docker container

Instead of manually setting up a development environment, you can use `Docker
<https://docs.docker.com/get-docker/>`_ to automatically create the environment with just several
commands. Pandas provides a `DockerFile` in the root directory to build a Docker image
commands. Pandas provides a ``DockerFile`` in the root directory to build a Docker image
with a full pandas development environment.

**Docker Commands**

Pass your GitHub username in the `DockerFile` to use your own fork::
Pass your GitHub username in the ``DockerFile`` to use your own fork::

# Build the image pandas-yourname-env
docker build --tag pandas-yourname-env .
Expand All @@ -172,7 +172,7 @@ Even easier, you can integrate Docker with the following IDEs:
**Visual Studio Code**

You can use the DockerFile to launch a remote session with Visual Studio Code,
a popular free IDE, using the `.devcontainer.json` file.
a popular free IDE, using the ``.devcontainer.json`` file.
See https://code.visualstudio.com/docs/remote/containers for details.

**PyCharm (Professional)**
Expand Down Expand Up @@ -782,7 +782,7 @@ As part of :ref:`Continuous Integration <contributing.ci>` checks we run::

isort --check-only pandas

to check that imports are correctly formatted as per the `setup.cfg`.
to check that imports are correctly formatted as per the ``setup.cfg``.

If you see output like the below in :ref:`Continuous Integration <contributing.ci>` checks:

Expand Down Expand Up @@ -979,7 +979,7 @@ For example, quite a few functions in pandas accept a ``dtype`` argument. This c
def as_type(dtype: Dtype) -> ...:
...

This module will ultimately house types for repeatedly used concepts like "path-like", "array-like", "numeric", etc... and can also hold aliases for commonly appearing parameters like `axis`. Development of this module is active so be sure to refer to the source for the most up to date list of available types.
This module will ultimately house types for repeatedly used concepts like "path-like", "array-like", "numeric", etc... and can also hold aliases for commonly appearing parameters like ``axis``. Development of this module is active so be sure to refer to the source for the most up to date list of available types.

Validating type hints
~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1302,7 +1302,7 @@ Or with one of the following constructs::

Using `pytest-xdist <https://pypi.org/project/pytest-xdist>`_, one can
speed up local testing on multicore machines. To use this feature, you will
need to install `pytest-xdist` via::
need to install ``pytest-xdist`` via::

pip install pytest-xdist

Expand Down Expand Up @@ -1465,7 +1465,7 @@ The following defines how a commit message should be structured. Please referen
relevant GitHub issues in your commit message using GH1234 or #1234. Either style
is fine, but the former is generally preferred:

* a subject line with `< 80` chars.
* a subject line with ``< 80`` chars.
* One blank line.
* Optionally, a commit message body.

Expand Down
60 changes: 30 additions & 30 deletions doc/source/development/contributing_docstring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The next example gives an idea of what a docstring looks like:
"""
Add up two integer numbers.

This function simply wraps the `+` operator, and does not
This function simply wraps the ``+`` operator, and does not
do anything interesting, except for illustrating what
the docstring of a very simple function looks like.

Expand All @@ -39,7 +39,7 @@ The next example gives an idea of what a docstring looks like:
Returns
-------
int
The sum of `num1` and `num2`.
The sum of ``num1`` and ``num2``.

See Also
--------
Expand Down Expand Up @@ -126,9 +126,9 @@ backticks. The following are considered inline code:

def add_values(arr):
"""
Add the values in `arr`.
Add the values in ``arr``.

This is equivalent to Python `sum` of :meth:`pandas.Series.sum`.
This is equivalent to Python ``sum`` of :meth:`pandas.Series.sum`.

Some sections are omitted here for simplicity.
"""
Expand All @@ -144,13 +144,13 @@ backticks. The following are considered inline code:

With several mistakes in the docstring.

It has a blank like after the signature `def func():`.
It has a blank like after the signature ``def func():``.

The text 'Some function' should go in the line after the
opening quotes of the docstring, not in the same line.

There is a blank line between the docstring and the first line
of code `foo = 1`.
of code ``foo = 1``.

The closing quotes should be in the next line, not in this one."""

Expand Down Expand Up @@ -269,11 +269,11 @@ after, and not between the line with the word "Parameters" and the one with
the hyphens.

After the title, each parameter in the signature must be documented, including
`*args` and `**kwargs`, but not `self`.
``*args`` and ``**kwargs``, but not ``self``.

The parameters are defined by their name, followed by a space, a colon, another
space, and the type (or types). Note that the space between the name and the
colon is important. Types are not defined for `*args` and `**kwargs`, but must
colon is important. Types are not defined for ``*args`` and ``**kwargs``, but must
be defined for all other parameters. After the parameter definition, it is
required to have a line with the parameter description, which is indented, and
can have multiple lines. The description must start with a capital letter, and
Expand All @@ -285,13 +285,13 @@ comma at the end of the type. The exact form of the type in this case will be
argument means, which can be added after a comma "int, default -1, meaning all
cpus".

In cases where the default value is `None`, meaning that the value will not be
In cases where the default value is ``None``, meaning that the value will not be
used. Instead of "str, default None", it is preferred to write "str, optional".
When `None` is a value being used, we will keep the form "str, default None".
For example, in `df.to_csv(compression=None)`, `None` is not a value being used,
When ``None`` is a value being used, we will keep the form "str, default None".
For example, in ``df.to_csv(compression=None)``, ``None`` is not a value being used,
but means that compression is optional, and no compression is being used if not
provided. In this case we will use `str, optional`. Only in cases like
`func(value=None)` and `None` is being used in the same way as `0` or `foo`
provided. In this case we will use ``str, optional``. Only in cases like
``func(value=None)`` and ``None`` is being used in the same way as ``0`` or ``foo``
would be used, then we will specify "str, int or None, default None".

**Good:**
Expand Down Expand Up @@ -331,13 +331,13 @@ would be used, then we will specify "str, int or None, default None".
specified kind.

Note the blank line between the parameters title and the first
parameter. Also, note that after the name of the parameter `kind`
parameter. Also, note that after the name of the parameter ``kind``
and before the colon, a space is missing.

Also, note that the parameter descriptions do not start with a
capital letter, and do not finish with a dot.

Finally, the `**kwargs` parameter is missing.
Finally, the ``**kwargs`` parameter is missing.

Parameters
----------
Expand All @@ -361,9 +361,9 @@ boolean, etc):
* str
* bool

For complex types, define the subtypes. For `dict` and `tuple`, as more than
For complex types, define the subtypes. For ``dict`` and ``tuple``, as more than
one type is present, we use the brackets to help read the type (curly brackets
for `dict` and normal brackets for `tuple`):
for ``dict`` and normal brackets for ``tuple``):

* list of int
* dict of {str : int}
Expand Down Expand Up @@ -512,8 +512,8 @@ This section is used to let users know about pandas functionality
related to the one being documented. In rare cases, if no related methods
or functions can be found at all, this section can be skipped.

An obvious example would be the `head()` and `tail()` methods. As `tail()` does
the equivalent as `head()` but at the end of the `Series` or `DataFrame`
An obvious example would be the ``head()`` and ``tail()`` methods. As ``tail()`` does
the equivalent as ``head()`` but at the end of the ``Series`` or ``DataFrame``
instead of at the beginning, it is good to let the users know about it.

To give an intuition on what can be considered related, here there are some
Expand Down Expand Up @@ -608,8 +608,8 @@ Examples in docstrings, besides illustrating the usage of the function or
method, must be valid Python code, that returns the given output in a
deterministic way, and that can be copied and run by users.

Examples are presented as a session in the Python terminal. `>>>` is used to
present code. `...` is used for code continuing from the previous line.
Examples are presented as a session in the Python terminal. ``>>>`` is used to
present code. ``...`` is used for code continuing from the previous line.
Output is presented immediately after the last line of code generating the
output (no blank lines in between). Comments describing the examples can
be added with blank lines before and after them.
Expand Down Expand Up @@ -664,7 +664,7 @@ A simple example could be:
4 Falcon
dtype: object

With the `n` parameter, we can change the number of returned rows:
With the ``n`` parameter, we can change the number of returned rows:

>>> s.head(n=3)
0 Ant
Expand Down Expand Up @@ -742,7 +742,7 @@ positional arguments ``head(3)``.

def fillna(self, value):
"""
Replace missing values by `value`.
Replace missing values by ``value``.

Examples
--------
Expand Down Expand Up @@ -771,7 +771,7 @@ positional arguments ``head(3)``.

def contains(self, pattern, case_sensitive=True, na=numpy.nan):
"""
Return whether each value contains `pattern`.
Return whether each value contains ``pattern``.

In this case, we are illustrating how to use sections, even
if the example is simple enough and does not require them.
Expand All @@ -788,8 +788,8 @@ positional arguments ``head(3)``.

**Case sensitivity**

With `case_sensitive` set to `False` we can match `a` with both
`a` and `A`:
With ``case_sensitive`` set to ``False`` we can match ``a`` with both
``a`` and ``A``:

>>> s.contains(pattern='a', case_sensitive=False)
0 True
Expand All @@ -800,7 +800,7 @@ positional arguments ``head(3)``.

**Missing values**

We can fill missing values in the output using the `na` parameter:
We can fill missing values in the output using the ``na`` parameter:

>>> s.contains(pattern='a', na=False)
0 False
Expand All @@ -824,9 +824,9 @@ positional arguments ``head(3)``.
Try to use meaningful data, when it makes the example easier
to understand.

Try to avoid positional arguments like in `df.method(1)`. They
Try to avoid positional arguments like in ``df.method(1)``. They
can be all right if previously defined with a meaningful name,
like in `present_value(interest_rate)`, but avoid them otherwise.
like in ``present_value(interest_rate)``, but avoid them otherwise.

When presenting the behavior with different parameters, do not place
all the calls one next to the other. Instead, add a short sentence
Expand Down Expand Up @@ -914,7 +914,7 @@ plot will be generated automatically when building the documentation.
class Series:
def plot(self):
"""
Generate a plot with the `Series` data.
Generate a plot with the ``Series`` data.

Examples
--------
Expand Down
2 changes: 1 addition & 1 deletion doc/source/development/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ This can be a convenient way to extend pandas objects without subclassing them.
If you write a custom accessor, make a pull request adding it to our
:ref:`ecosystem` page.

We highly recommend validating the data in your accessor's `__init__`.
We highly recommend validating the data in your accessor's ``__init__``.
In our ``GeoAccessor``, we validate that the data contains the expected columns,
raising an ``AttributeError`` when the validation fails.
For a ``Series`` accessor, you should validate the ``dtype`` if the accessor
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ecosystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ arrays can be stored inside pandas' Series and DataFrame.
`Pint-Pandas`_
~~~~~~~~~~~~~~

`Pint-Pandas <https://github.com/hgrecco/pint-pandas>` provides an extension type for
``Pint-Pandas <https://github.com/hgrecco/pint-pandas>`` provides an extension type for
storing numeric arrays with units. These arrays can be stored inside pandas'
Series and DataFrame. Operations between Series and DataFrame columns which
use pint's extension array are then units aware.
Expand Down
6 changes: 3 additions & 3 deletions doc/source/getting_started/comparison/comparison_with_sql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ As is customary, we import pandas and NumPy as follows:
import numpy as np

Most of the examples will utilize the ``tips`` dataset found within pandas tests. We'll read
the data into a DataFrame called `tips` and assume we have a database table of the same name and
the data into a DataFrame called ``tips`` and assume we have a database table of the same name and
structure.

.. ipython:: python
Expand Down Expand Up @@ -429,7 +429,7 @@ Top n rows per group
.query('rn < 3')
.sort_values(['day', 'rn']))

the same using `rank(method='first')` function
the same using ``rank(method='first')`` function

.. ipython:: python

Expand All @@ -453,7 +453,7 @@ the same using `rank(method='first')` function

Let's find tips with (rank < 3) per gender group for (tips < 2).
Notice that when using ``rank(method='min')`` function
`rnk_min` remains the same for the same `tip`
``rnk_min`` remains the same for the same ``tip``
(as Oracle's RANK() function)

.. ipython:: python
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ In Linux/Mac you can run ``which python`` on your terminal and it will tell you
using. If it's something like "/usr/bin/python", you're using the Python from the system, which is not recommended.

It is highly recommended to use ``conda``, for quick installation and for package and dependency updates.
You can find simple installation instructions for pandas in this document: `installation instructions </getting_started.html>`.
You can find simple installation instructions for pandas in this document: ``installation instructions </getting_started.html>``.

Installing from source
~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ on the grouped data as well:
:align: center

.. note::
The `Pclass` column contains numerical data but actually
The ``Pclass`` column contains numerical data but actually
represents 3 categories (or factors) with respectively the labels ‘1’,
‘2’ and ‘3’. Calculating statistics on these does not make much sense.
Therefore, pandas provides a ``Categorical`` data type to handle this
Expand Down
Loading