Skip to content

DOC: Removing tailing whitespaces in .rst files #24281

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 1 commit into from
Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions doc/source/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ can think of ``MultiIndex`` as an array of tuples where each tuple is unique. A
``MultiIndex`` can be created from a list of arrays (using
:meth:`MultiIndex.from_arrays`), an array of tuples (using
:meth:`MultiIndex.from_tuples`), a crossed set of iterables (using
:meth:`MultiIndex.from_product`), or a :class:`DataFrame` (using
:meth:`MultiIndex.from_product`), or a :class:`DataFrame` (using
:meth:`MultiIndex.from_frame`). The ``Index`` constructor will attempt to return
a ``MultiIndex`` when it is passed a list of tuples. The following examples
demonstrate different ways to initialize MultiIndexes.
Expand All @@ -81,7 +81,7 @@ to use the :meth:`MultiIndex.from_product` method:
iterables = [['bar', 'baz', 'foo', 'qux'], ['one', 'two']]
pd.MultiIndex.from_product(iterables, names=['first', 'second'])

You can also construct a ``MultiIndex`` from a ``DataFrame`` directly, using
You can also construct a ``MultiIndex`` from a ``DataFrame`` directly, using
the method :meth:`MultiIndex.from_frame`. This is a complementary method to
:meth:`MultiIndex.to_frame`.

Expand Down
62 changes: 31 additions & 31 deletions doc/source/categorical.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ with R's ``factor``.

`Categoricals` are a pandas data type corresponding to categorical variables in
statistics. A categorical variable takes on a limited, and usually fixed,
number of possible values (`categories`; `levels` in R). Examples are gender,
social class, blood type, country affiliation, observation time or rating via
number of possible values (`categories`; `levels` in R). Examples are gender,
social class, blood type, country affiliation, observation time or rating via
Likert scales.

In contrast to statistical categorical variables, categorical data might have an order (e.g.
Expand Down Expand Up @@ -133,7 +133,7 @@ This conversion is likewise done column by column:
Controlling Behavior
~~~~~~~~~~~~~~~~~~~~

In the examples above where we passed ``dtype='category'``, we used the default
In the examples above where we passed ``dtype='category'``, we used the default
behavior:

1. Categories are inferred from the data.
Expand Down Expand Up @@ -170,8 +170,8 @@ are consistent among all columns.
categories for each column, the ``categories`` parameter can be determined programmatically by
``categories = pd.unique(df.to_numpy().ravel())``.

If you already have ``codes`` and ``categories``, you can use the
:func:`~pandas.Categorical.from_codes` constructor to save the factorize step
If you already have ``codes`` and ``categories``, you can use the
:func:`~pandas.Categorical.from_codes` constructor to save the factorize step
during normal constructor mode:

.. ipython:: python
Expand All @@ -184,7 +184,7 @@ during normal constructor mode:
Regaining Original Data
~~~~~~~~~~~~~~~~~~~~~~~

To get back to the original ``Series`` or NumPy array, use
To get back to the original ``Series`` or NumPy array, use
``Series.astype(original_dtype)`` or ``np.asarray(categorical)``:

.. ipython:: python
Expand Down Expand Up @@ -222,7 +222,7 @@ This information can be stored in a :class:`~pandas.api.types.CategoricalDtype`.
The ``categories`` argument is optional, which implies that the actual categories
should be inferred from whatever is present in the data when the
:class:`pandas.Categorical` is created. The categories are assumed to be unordered
by default.
by default.

.. ipython:: python

Expand Down Expand Up @@ -277,7 +277,7 @@ All instances of ``CategoricalDtype`` compare equal to the string ``'category'``
Description
-----------

Using :meth:`~DataFrame.describe` on categorical data will produce similar
Using :meth:`~DataFrame.describe` on categorical data will produce similar
output to a ``Series`` or ``DataFrame`` of type ``string``.

.. ipython:: python
Expand All @@ -292,9 +292,9 @@ output to a ``Series`` or ``DataFrame`` of type ``string``.
Working with categories
-----------------------

Categorical data has a `categories` and a `ordered` property, which list their
possible values and whether the ordering matters or not. These properties are
exposed as ``s.cat.categories`` and ``s.cat.ordered``. If you don't manually
Categorical data has a `categories` and a `ordered` property, which list their
possible values and whether the ordering matters or not. These properties are
exposed as ``s.cat.categories`` and ``s.cat.ordered``. If you don't manually
specify categories and ordering, they are inferred from the passed arguments.

.. ipython:: python
Expand All @@ -314,7 +314,7 @@ It's also possible to pass in the categories in a specific order:

.. note::

New categorical data are **not** automatically ordered. You must explicitly
New categorical data are **not** automatically ordered. You must explicitly
pass ``ordered=True`` to indicate an ordered ``Categorical``.


Expand All @@ -338,8 +338,8 @@ It's also possible to pass in the categories in a specific order:
Renaming categories
~~~~~~~~~~~~~~~~~~~

Renaming categories is done by assigning new values to the
``Series.cat.categories`` property or by using the
Renaming categories is done by assigning new values to the
``Series.cat.categories`` property or by using the
:meth:`~pandas.Categorical.rename_categories` method:


Expand Down Expand Up @@ -385,7 +385,7 @@ Categories must also not be ``NaN`` or a `ValueError` is raised:
Appending new categories
~~~~~~~~~~~~~~~~~~~~~~~~

Appending categories can be done by using the
Appending categories can be done by using the
:meth:`~pandas.Categorical.add_categories` method:

.. ipython:: python
Expand All @@ -397,8 +397,8 @@ Appending categories can be done by using the
Removing categories
~~~~~~~~~~~~~~~~~~~

Removing categories can be done by using the
:meth:`~pandas.Categorical.remove_categories` method. Values which are removed
Removing categories can be done by using the
:meth:`~pandas.Categorical.remove_categories` method. Values which are removed
are replaced by ``np.nan``.:

.. ipython:: python
Expand All @@ -421,8 +421,8 @@ Removing unused categories can also be done:
Setting categories
~~~~~~~~~~~~~~~~~~

If you want to do remove and add new categories in one step (which has some
speed advantage), or simply set the categories to a predefined scale,
If you want to do remove and add new categories in one step (which has some
speed advantage), or simply set the categories to a predefined scale,
use :meth:`~pandas.Categorical.set_categories`.


Expand Down Expand Up @@ -618,10 +618,10 @@ When you compare two unordered categoricals with the same categories, the order
Operations
----------

Apart from :meth:`Series.min`, :meth:`Series.max` and :meth:`Series.mode`, the
Apart from :meth:`Series.min`, :meth:`Series.max` and :meth:`Series.mode`, the
following operations are possible with categorical data:

``Series`` methods like :meth:`Series.value_counts` will use all categories,
``Series`` methods like :meth:`Series.value_counts` will use all categories,
even if some categories are not present in the data:

.. ipython:: python
Expand Down Expand Up @@ -666,7 +666,7 @@ that only values already in `categories` can be assigned.
Getting
~~~~~~~

If the slicing operation returns either a ``DataFrame`` or a column of type
If the slicing operation returns either a ``DataFrame`` or a column of type
``Series``, the ``category`` dtype is preserved.

.. ipython:: python
Expand All @@ -681,7 +681,7 @@ If the slicing operation returns either a ``DataFrame`` or a column of type
df.loc["h":"j", "cats"]
df[df["cats"] == "b"]

An example where the category type is not preserved is if you take one single
An example where the category type is not preserved is if you take one single
row: the resulting ``Series`` is of dtype ``object``:

.. ipython:: python
Expand All @@ -702,7 +702,7 @@ of length "1".
The is in contrast to R's `factor` function, where ``factor(c(1,2,3))[1]``
returns a single value `factor`.

To get a single value ``Series`` of type ``category``, you pass in a list with
To get a single value ``Series`` of type ``category``, you pass in a list with
a single value:

.. ipython:: python
Expand Down Expand Up @@ -756,7 +756,7 @@ That means, that the returned values from methods and properties on the accessor
Setting
~~~~~~~

Setting values in a categorical column (or ``Series``) works as long as the
Setting values in a categorical column (or ``Series``) works as long as the
value is included in the `categories`:

.. ipython:: python
Expand Down Expand Up @@ -836,9 +836,9 @@ Unioning

.. versionadded:: 0.19.0

If you want to combine categoricals that do not necessarily have the same
If you want to combine categoricals that do not necessarily have the same
categories, the :func:`~pandas.api.types.union_categoricals` function will
combine a list-like of categoricals. The new categories will be the union of
combine a list-like of categoricals. The new categories will be the union of
the categories being combined.

.. ipython:: python
Expand Down Expand Up @@ -887,8 +887,8 @@ using the ``ignore_ordered=True`` argument.
b = pd.Categorical(["c", "b", "a"], ordered=True)
union_categoricals([a, b], ignore_order=True)

:func:`~pandas.api.types.union_categoricals` also works with a
``CategoricalIndex``, or ``Series`` containing categorical data, but note that
:func:`~pandas.api.types.union_categoricals` also works with a
``CategoricalIndex``, or ``Series`` containing categorical data, but note that
the resulting array will always be a plain ``Categorical``:

.. ipython:: python
Expand Down Expand Up @@ -1179,8 +1179,8 @@ Setting the index will create a ``CategoricalIndex``:
Side Effects
~~~~~~~~~~~~

Constructing a ``Series`` from a ``Categorical`` will not copy the input
``Categorical``. This means that changes to the ``Series`` will in most cases
Constructing a ``Series`` from a ``Categorical`` will not copy the input
``Categorical``. This means that changes to the ``Series`` will in most cases
change the original ``Categorical``:

.. ipython:: python
Expand Down
28 changes: 14 additions & 14 deletions doc/source/comparison_with_sas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ String Processing
Length
~~~~~~

SAS determines the length of a character string with the
SAS determines the length of a character string with the
`LENGTHN <https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002284668.htm>`__
and `LENGTHC <https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002283942.htm>`__
functions. ``LENGTHN`` excludes trailing blanks and ``LENGTHC`` includes trailing blanks.
Expand All @@ -378,7 +378,7 @@ functions. ``LENGTHN`` excludes trailing blanks and ``LENGTHC`` includes trailin
run;

Python determines the length of a character string with the ``len`` function.
``len`` includes trailing blanks. Use ``len`` and ``rstrip`` to exclude
``len`` includes trailing blanks. Use ``len`` and ``rstrip`` to exclude
trailing blanks.

.. ipython:: python
Expand All @@ -390,9 +390,9 @@ trailing blanks.
Find
~~~~

SAS determines the position of a character in a string with the
SAS determines the position of a character in a string with the
`FINDW <https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002978282.htm>`__ function.
``FINDW`` takes the string defined by the first argument and searches for the first position of the substring
``FINDW`` takes the string defined by the first argument and searches for the first position of the substring
you supply as the second argument.

.. code-block:: sas
Expand All @@ -402,10 +402,10 @@ you supply as the second argument.
put(FINDW(sex,'ale'));
run;

Python determines the position of a character in a string with the
``find`` function. ``find`` searches for the first position of the
substring. If the substring is found, the function returns its
position. Keep in mind that Python indexes are zero-based and
Python determines the position of a character in a string with the
``find`` function. ``find`` searches for the first position of the
substring. If the substring is found, the function returns its
position. Keep in mind that Python indexes are zero-based and
the function will return -1 if it fails to find the substring.

.. ipython:: python
Expand All @@ -416,7 +416,7 @@ the function will return -1 if it fails to find the substring.
Substring
~~~~~~~~~

SAS extracts a substring from a string based on its position with the
SAS extracts a substring from a string based on its position with the
`SUBSTR <https://www2.sas.com/proceedings/sugi25/25/cc/25p088.pdf>`__ function.

.. code-block:: sas
Expand All @@ -427,7 +427,7 @@ SAS extracts a substring from a string based on its position with the
run;

With pandas you can use ``[]`` notation to extract a substring
from a string by position locations. Keep in mind that Python
from a string by position locations. Keep in mind that Python
indexes are zero-based.

.. ipython:: python
Expand All @@ -439,7 +439,7 @@ Scan
~~~~

The SAS `SCAN <https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000214639.htm>`__
function returns the nth word from a string. The first argument is the string you want to parse and the
function returns the nth word from a string. The first argument is the string you want to parse and the
second argument specifies which word you want to extract.

.. code-block:: sas
Expand All @@ -452,10 +452,10 @@ second argument specifies which word you want to extract.
John Smith;
Jane Cook;
;;;
run;
run;

Python extracts a substring from a string based on its text
by using regular expressions. There are much more powerful
Python extracts a substring from a string based on its text
by using regular expressions. There are much more powerful
approaches, but this just shows a simple approach.

.. ipython:: python
Expand Down
24 changes: 12 additions & 12 deletions doc/source/computation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Statistical Functions
Percent Change
~~~~~~~~~~~~~~

``Series``, ``DataFrame``, and ``Panel`` all have a method
:meth:`~DataFrame.pct_change` to compute the percent change over a given number
of periods (using ``fill_method`` to fill NA/null values *before* computing
``Series``, ``DataFrame``, and ``Panel`` all have a method
:meth:`~DataFrame.pct_change` to compute the percent change over a given number
of periods (using ``fill_method`` to fill NA/null values *before* computing
the percent change).

.. ipython:: python
Expand All @@ -35,7 +35,7 @@ the percent change).
Covariance
~~~~~~~~~~

:meth:`Series.cov` can be used to compute covariance between series
:meth:`Series.cov` can be used to compute covariance between series
(excluding missing values).

.. ipython:: python
Expand All @@ -44,7 +44,7 @@ Covariance
s2 = pd.Series(np.random.randn(1000))
s1.cov(s2)

Analogously, :meth:`DataFrame.cov` to compute pairwise covariances among the
Analogously, :meth:`DataFrame.cov` to compute pairwise covariances among the
series in the DataFrame, also excluding NA/null values.

.. _computation.covariance.caveats:
Expand Down Expand Up @@ -87,7 +87,7 @@ Correlation
~~~~~~~~~~~

Correlation may be computed using the :meth:`~DataFrame.corr` method.
Using the ``method`` parameter, several methods for computing correlations are
Using the ``method`` parameter, several methods for computing correlations are
provided:

.. csv-table::
Expand Down Expand Up @@ -158,8 +158,8 @@ compute the correlation based on histogram intersection:

frame.corr(method=histogram_intersection)

A related method :meth:`~DataFrame.corrwith` is implemented on DataFrame to
compute the correlation between like-labeled Series contained in different
A related method :meth:`~DataFrame.corrwith` is implemented on DataFrame to
compute the correlation between like-labeled Series contained in different
DataFrame objects.

.. ipython:: python
Expand All @@ -176,7 +176,7 @@ DataFrame objects.
Data ranking
~~~~~~~~~~~~

The :meth:`~Series.rank` method produces a data ranking with ties being
The :meth:`~Series.rank` method produces a data ranking with ties being
assigned the mean of the ranks (by default) for the group:

.. ipython:: python
Expand All @@ -185,8 +185,8 @@ assigned the mean of the ranks (by default) for the group:
s['d'] = s['b'] # so there's a tie
s.rank()

:meth:`~DataFrame.rank` is also a DataFrame method and can rank either the rows
(``axis=0``) or the columns (``axis=1``). ``NaN`` values are excluded from the
:meth:`~DataFrame.rank` is also a DataFrame method and can rank either the rows
(``axis=0``) or the columns (``axis=1``). ``NaN`` values are excluded from the
ranking.

.. ipython:: python
Expand Down Expand Up @@ -637,7 +637,7 @@ perform multiple computations on the data. These operations are similar to the :
r = dfa.rolling(window=60, min_periods=1)
r

We can aggregate by passing a function to the entire DataFrame, or select a
We can aggregate by passing a function to the entire DataFrame, or select a
Series (or multiple Series) via standard ``__getitem__``.

.. ipython:: python
Expand Down
Loading