Skip to content

Commit 52aae08

Browse files
datapythonistaPingviinituutti
authored andcommitted
DOC: Fixes to the docs style (pandas-dev#24182)
1 parent 7fd191d commit 52aae08

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

doc/source/advanced.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ they need to be sorted. As with any index, you can use :meth:`~DataFrame.sort_in
563563

564564
.. ipython:: python
565565
566-
import random; random.shuffle(tuples)
566+
import random
567+
random.shuffle(tuples)
567568
s = pd.Series(np.random.randn(8), index=pd.MultiIndex.from_tuples(tuples))
568569
s
569570
s.sort_index()

doc/source/categorical.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ Setting values by assigning categorical data will also check that the `categorie
782782
df
783783
try:
784784
df.loc["j":"k", "cats"] = pd.Categorical(["b", "b"],
785-
categories=["a", "b", "c"])
785+
categories=["a", "b", "c"])
786786
except ValueError as e:
787787
print("ValueError:", str(e))
788788

doc/source/extending.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ your ``MyExtensionArray`` class, as follows:
160160

161161
.. code-block:: python
162162
163+
from pandas.core.arrays import ExtensionArray, ExtensionScalarOpsMixin
164+
163165
class MyExtensionArray(ExtensionArray, ExtensionScalarOpsMixin):
164166
pass
165167
@@ -269,7 +271,7 @@ Below example shows how to define ``SubclassedSeries`` and ``SubclassedDataFrame
269271

270272
.. code-block:: python
271273
272-
class SubclassedSeries(Series):
274+
class SubclassedSeries(pd.Series):
273275
274276
@property
275277
def _constructor(self):
@@ -280,7 +282,7 @@ Below example shows how to define ``SubclassedSeries`` and ``SubclassedDataFrame
280282
return SubclassedDataFrame
281283
282284
283-
class SubclassedDataFrame(DataFrame):
285+
class SubclassedDataFrame(pd.DataFrame):
284286
285287
@property
286288
def _constructor(self):
@@ -342,7 +344,7 @@ Below is an example to define two original properties, "internal_cache" as a tem
342344

343345
.. code-block:: python
344346
345-
class SubclassedDataFrame2(DataFrame):
347+
class SubclassedDataFrame2(pd.DataFrame):
346348
347349
# temporary properties
348350
_internal_names = pd.DataFrame._internal_names + ['internal_cache']

doc/source/merging.rst

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.. ipython:: python
66
:suppress:
77
8+
from matplotlib import pyplot as plt
89
import pandas.util._doctools as doctools
910
p = doctools.TablePlotter()
1011

setup.cfg

+9-8
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,18 @@ exclude =
3232

3333
[flake8-rst]
3434
bootstrap =
35-
import pandas as pd
3635
import numpy as np
36+
import pandas as pd
37+
np # avoiding error when importing again numpy or pandas
38+
pd # (in some cases we want to do it to show users)
3739
ignore = E402, # module level import not at top of file
3840
W503, # line break before binary operator
41+
# Classes/functions in different blocks can generate those errors
42+
E302, # expected 2 blank lines, found 0
43+
E305, # expected 2 blank lines after class or function definition, found 0
44+
# We use semicolon at the end to avoid displaying plot objects
45+
E703, # statement ends with a semicolon
46+
3947
exclude =
4048
doc/source/whatsnew/v0.7.0.rst
4149
doc/source/whatsnew/v0.7.3.rst
@@ -69,23 +77,16 @@ exclude =
6977
doc/source/whatsnew/v0.23.2.rst
7078
doc/source/whatsnew/v0.24.0.rst
7179
doc/source/10min.rst
72-
doc/source/advanced.rst
7380
doc/source/basics.rst
74-
doc/source/categorical.rst
7581
doc/source/contributing_docstring.rst
76-
doc/source/contributing.rst
7782
doc/source/dsintro.rst
7883
doc/source/enhancingperf.rst
79-
doc/source/extending.rst
8084
doc/source/groupby.rst
8185
doc/source/indexing.rst
8286
doc/source/merging.rst
8387
doc/source/missing_data.rst
8488
doc/source/options.rst
8589
doc/source/release.rst
86-
doc/source/comparison_with_sas.rst
87-
doc/source/comparison_with_sql.rst
88-
doc/source/comparison_with_stata.rst
8990
doc/source/reshaping.rst
9091
doc/source/visualization.rst
9192

0 commit comments

Comments
 (0)