@@ -457,12 +457,14 @@ For example, with a single value:
457
457
float
458
458
Random number generated.
459
459
"""
460
- return random.random()
460
+ return np. random.random()
461
461
462
462
With more than one value:
463
463
464
464
.. code-block :: python
465
465
466
+ import string
467
+
466
468
def random_letters ():
467
469
"""
468
470
Generate and return a sequence of random letters.
@@ -477,8 +479,8 @@ With more than one value:
477
479
letters : str
478
480
String of random letters.
479
481
"""
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)
482
484
for i in range (length))
483
485
return length, letters
484
486
@@ -499,7 +501,7 @@ If the method yields its value:
499
501
Random number generated.
500
502
"""
501
503
while True :
502
- yield random.random()
504
+ yield np. random.random()
503
505
504
506
.. _docstring.see_also :
505
507
@@ -686,8 +688,8 @@ shown:
686
688
687
689
.. code-block :: python
688
690
689
- import numpy as np # noqa: F401
690
- import pandas as pd # noqa: F401
691
+ import numpy as np
692
+ import pandas as pd
691
693
692
694
Any other module used in the examples must be explicitly imported, one per line (as
693
695
recommended in :pep: `8#imports `)
@@ -776,7 +778,7 @@ positional arguments ``head(3)``.
776
778
777
779
Examples
778
780
--------
779
- >>> s = pd.Series('Antelope', 'Lion', 'Zebra', numpy .nan)
781
+ >>> s = pd.Series('Antelope', 'Lion', 'Zebra', np .nan)
780
782
>>> s.contains(pattern='a')
781
783
0 False
782
784
1 False
@@ -834,7 +836,7 @@ positional arguments ``head(3)``.
834
836
--------
835
837
>>> import numpy as np
836
838
>>> import pandas as pd
837
- >>> df = pd.DataFrame(numpy .random.randn(3, 3),
839
+ >>> df = pd.DataFrame(np .random.randn(3, 3),
838
840
... columns=('a', 'b', 'c'))
839
841
>>> df.method(1)
840
842
21
0 commit comments