Skip to content

Commit 98070c1

Browse files
FHaasegfyoung
authored andcommitted
Fix PEP-8 issues in gotchas.rst (#23909)
Signed-off-by: Fabian Haase <[email protected]>
1 parent cdbd004 commit 98070c1

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

doc/source/gotchas.rst

+7-11
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@ Frequently Asked Questions (FAQ)
99
:suppress:
1010
1111
import numpy as np
12+
import pandas as pd
13+
1214
np.random.seed(123456)
1315
np.set_printoptions(precision=4, suppress=True)
14-
import pandas as pd
1516
pd.options.display.max_rows = 15
16-
import matplotlib
17-
# matplotlib.style.use('default')
18-
import matplotlib.pyplot as plt
19-
plt.close('all')
2017
2118
.. _df-memory-usage:
2219

@@ -36,8 +33,7 @@ when calling :meth:`~DataFrame.info`:
3633
dtypes = ['int64', 'float64', 'datetime64[ns]', 'timedelta64[ns]',
3734
'complex128', 'object', 'bool']
3835
n = 5000
39-
data = dict([(t, np.random.randint(100, size=n).astype(t))
40-
for t in dtypes])
36+
data = {t: np.random.randint(100, size=n).astype(t) for t in dtypes}
4137
df = pd.DataFrame(data)
4238
df['categorical'] = df['object'].astype('category')
4339
@@ -98,8 +94,8 @@ of the following code should be:
9894

9995
.. code-block:: python
10096
101-
>>> if pd.Series([False, True, False]): # noqa: E999
102-
...
97+
>>> if pd.Series([False, True, False]):
98+
... pass
10399
104100
Should it be ``True`` because it's not zero-length, or ``False`` because there
105101
are ``False`` values? It is unclear, so instead, pandas raises a ``ValueError``:
@@ -329,8 +325,8 @@ constructors using something similar to the following:
329325

330326
.. ipython:: python
331327
332-
x = np.array(list(range(10)), '>i4') # big endian
333-
newx = x.byteswap().newbyteorder() # force native byteorder
328+
x = np.array(list(range(10)), '>i4') # big endian
329+
newx = x.byteswap().newbyteorder() # force native byteorder
334330
s = pd.Series(newx)
335331
336332
See `the NumPy documentation on byte order

0 commit comments

Comments
 (0)