Skip to content

DOC: Remove flake8 errors for basics.rst and contributing_docstring.rst #24598

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 3 commits into from
Jan 4, 2019
Merged
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
18 changes: 10 additions & 8 deletions doc/source/contributing_docstring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,14 @@ For example, with a single value:
float
Random number generated.
"""
return random.random()
return np.random.random()

With more than one value:

.. code-block:: python

import string

def random_letters():
"""
Generate and return a sequence of random letters.
Expand All @@ -477,8 +479,8 @@ With more than one value:
letters : str
String of random letters.
"""
length = random.randint(1, 10)
letters = ''.join(random.choice(string.ascii_lowercase)
length = np.random.randint(1, 10)
letters = ''.join(np.random.choice(string.ascii_lowercase)
for i in range(length))
return length, letters

Expand All @@ -499,7 +501,7 @@ If the method yields its value:
Random number generated.
"""
while True:
yield random.random()
yield np.random.random()

.. _docstring.see_also:

Expand Down Expand Up @@ -686,8 +688,8 @@ shown:

.. code-block:: python

import numpy as np # noqa: F401
import pandas as pd # noqa: F401
import numpy as np
import pandas as pd

Any other module used in the examples must be explicitly imported, one per line (as
recommended in :pep:`8#imports`)
Expand Down Expand Up @@ -776,7 +778,7 @@ positional arguments ``head(3)``.

Examples
--------
>>> s = pd.Series('Antelope', 'Lion', 'Zebra', numpy.nan)
>>> s = pd.Series('Antelope', 'Lion', 'Zebra', np.nan)
>>> s.contains(pattern='a')
0 False
1 False
Expand Down Expand Up @@ -834,7 +836,7 @@ positional arguments ``head(3)``.
--------
>>> import numpy as np
>>> import pandas as pd
>>> df = pd.DataFrame(numpy.random.randn(3, 3),
>>> df = pd.DataFrame(np.random.randn(3, 3),
... columns=('a', 'b', 'c'))
>>> df.method(1)
21
Expand Down