Skip to content

Commit f597a88

Browse files
saurav-chakravortyPingviinituutti
authored andcommitted
DOC: Remove flake8 errors for basics.rst and contributing_docstring.rst (pandas-dev#24598)
1 parent 479b3bd commit f597a88

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

doc/source/contributing_docstring.rst

+10-8
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,14 @@ For example, with a single value:
457457
float
458458
Random number generated.
459459
"""
460-
return random.random()
460+
return np.random.random()
461461
462462
With more than one value:
463463

464464
.. code-block:: python
465465
466+
import string
467+
466468
def random_letters():
467469
"""
468470
Generate and return a sequence of random letters.
@@ -477,8 +479,8 @@ With more than one value:
477479
letters : str
478480
String of random letters.
479481
"""
480-
length = random.randint(1, 10)
481-
letters = ''.join(random.choice(string.ascii_lowercase)
482+
length = np.random.randint(1, 10)
483+
letters = ''.join(np.random.choice(string.ascii_lowercase)
482484
for i in range(length))
483485
return length, letters
484486
@@ -499,7 +501,7 @@ If the method yields its value:
499501
Random number generated.
500502
"""
501503
while True:
502-
yield random.random()
504+
yield np.random.random()
503505
504506
.. _docstring.see_also:
505507

@@ -686,8 +688,8 @@ shown:
686688

687689
.. code-block:: python
688690
689-
import numpy as np # noqa: F401
690-
import pandas as pd # noqa: F401
691+
import numpy as np
692+
import pandas as pd
691693
692694
Any other module used in the examples must be explicitly imported, one per line (as
693695
recommended in :pep:`8#imports`)
@@ -776,7 +778,7 @@ positional arguments ``head(3)``.
776778
777779
Examples
778780
--------
779-
>>> s = pd.Series('Antelope', 'Lion', 'Zebra', numpy.nan)
781+
>>> s = pd.Series('Antelope', 'Lion', 'Zebra', np.nan)
780782
>>> s.contains(pattern='a')
781783
0 False
782784
1 False
@@ -834,7 +836,7 @@ positional arguments ``head(3)``.
834836
--------
835837
>>> import numpy as np
836838
>>> import pandas as pd
837-
>>> df = pd.DataFrame(numpy.random.randn(3, 3),
839+
>>> df = pd.DataFrame(np.random.randn(3, 3),
838840
... columns=('a', 'b', 'c'))
839841
>>> df.method(1)
840842
21

0 commit comments

Comments
 (0)