Skip to content

Commit

Permalink
DOC: define tips variable to avoid flake8-rst error
Browse files Browse the repository at this point in the history
  • Loading branch information
afeld authored Dec 30, 2020
1 parent cce169a commit d75c9e5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
9 changes: 8 additions & 1 deletion doc/source/getting_started/comparison/includes/filtering.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
DataFrames can be filtered in multiple ways; the most intuitive of which is using
:ref:`boolean indexing <indexing.boolean>`

.. ipython:: python
:suppress:
# ensure tips is defined when scanning with flake8-rst
if 'tips' not in vars():
tips = {}
.. ipython:: python
tips[tips["total_bill"] > 10]
The above statement is simply passing a ``Series`` of ``True``/``False`` objects to the DataFrame,
The above statement is simply passing a ``Series`` of ``True``/``False`` objectslake to the DataFrame,
returning all rows with ``True``.

.. ipython:: python
Expand Down
7 changes: 7 additions & 0 deletions doc/source/getting_started/comparison/includes/if_then.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
The same operation in pandas can be accomplished using
the ``where`` method from ``numpy``.

.. ipython:: python
:suppress:
# ensure tips is defined when scanning with flake8-rst
if 'tips' not in vars():
tips = {}
.. ipython:: python
tips["bucket"] = np.where(tips["total_bill"] < 10, "low", "high")
Expand Down
7 changes: 7 additions & 0 deletions doc/source/getting_started/comparison/includes/sorting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
pandas objects have a :meth:`DataFrame.sort_values` method, which
takes a list of columns to sort by.

.. ipython:: python
:suppress:
# ensure tips is defined when scanning with flake8-rst
if 'tips' not in vars():
tips = {}
.. ipython:: python
tips = tips.sort_values(["sex", "total_bill"])
Expand Down
7 changes: 7 additions & 0 deletions doc/source/getting_started/comparison/includes/time_date.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
:orphan:

.. ipython:: python
:suppress:
# ensure tips is defined when scanning with flake8-rst
if 'tips' not in vars():
tips = {}
.. ipython:: python
tips["date1"] = pd.Timestamp("2013-01-15")
Expand Down

0 comments on commit d75c9e5

Please sign in to comment.