Skip to content

Commit 04caa56

Browse files
alphaCTzo7Gjreback
authored andcommitted
Fixes example code in docstring of pandas.DataFrame.query (#21731)
1 parent 861287b commit 04caa56

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/frame.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,9 +2841,9 @@ def query(self, expr, inplace=False, **kwargs):
28412841
28422842
Examples
28432843
--------
2844-
>>> from numpy.random import randn
2845-
>>> from pandas import DataFrame
2846-
>>> df = pd.DataFrame(randn(10, 2), columns=list('ab'))
2844+
>>> import numpy as np
2845+
>>> import pandas as pd
2846+
>>> df = pd.DataFrame(np.random.randn(10, 2), columns=list('ab'))
28472847
>>> df.query('a > b')
28482848
>>> df[df.a > df.b] # same result as the previous expression
28492849
"""

0 commit comments

Comments
 (0)