Skip to content

Commit 6d0f3c6

Browse files
Fix: Removing in docstrings double blank lines and blank lines at the end (pandas-dev#23871)
1 parent 57f7fa8 commit 6d0f3c6

26 files changed

+2
-61
lines changed

pandas/core/algorithms.py

-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ def unique(values):
343343
--------
344344
pandas.Index.unique
345345
pandas.Series.unique
346-
347346
"""
348347

349348
values = _ensure_arraylike(values)

pandas/core/config.py

-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ class option_context(object):
385385
386386
>>> with option_context('display.max_rows', 10, 'display.max_columns', 5):
387387
... ...
388-
389388
"""
390389

391390
def __init__(self, *args):

pandas/core/dtypes/common.py

-1
Original file line numberDiff line numberDiff line change
@@ -2067,7 +2067,6 @@ def pandas_dtype(dtype):
20672067
Raises
20682068
------
20692069
TypeError if not a dtype
2070-
20712070
"""
20722071
# short-circuit
20732072
if isinstance(dtype, np.ndarray):

pandas/core/frame.py

-6
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,6 @@ def iterrows(self):
877877
--------
878878
itertuples : Iterate over DataFrame rows as namedtuples of the values.
879879
iteritems : Iterate over (column name, Series) pairs.
880-
881880
"""
882881
columns = self.columns
883882
klass = self._constructor_sliced
@@ -1722,7 +1721,6 @@ def from_csv(cls, path, header=0, sep=',', index_col=0, parse_dates=True,
17221721
Returns
17231722
-------
17241723
y : DataFrame
1725-
17261724
"""
17271725

17281726
warnings.warn("from_csv is deprecated. Please use read_csv(...) "
@@ -1963,7 +1961,6 @@ def to_feather(self, fname):
19631961
----------
19641962
fname : str
19651963
string file path
1966-
19671964
"""
19681965
from pandas.io.feather_format import to_feather
19691966
to_feather(self, fname)
@@ -3578,7 +3575,6 @@ def lookup(self, row_labels, col_labels):
35783575
--------
35793576
values : ndarray
35803577
The found values
3581-
35823578
"""
35833579
n = len(row_labels)
35843580
if n != len(col_labels):
@@ -4881,7 +4877,6 @@ def swaplevel(self, i=-2, j=-1, axis=0):
48814877
48824878
The indexes ``i`` and ``j`` are now optional, and default to
48834879
the two innermost levels of the index.
4884-
48854880
"""
48864881
result = self.copy()
48874882

@@ -7115,7 +7110,6 @@ def count(self, axis=0, level=None, numeric_only=False):
71157110
John 2
71167111
Lewis 1
71177112
Myla 1
7118-
71197113
"""
71207114
axis = self._get_axis_number(axis)
71217115
if level is not None:

pandas/core/groupby/generic.py

-1
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,6 @@ class DataFrameGroupBy(NDFrameGroupBy):
12941294
pandas.DataFrame.groupby.apply
12951295
pandas.DataFrame.groupby.transform
12961296
pandas.DataFrame.aggregate
1297-
12981297
""")
12991298

13001299
@Appender(_agg_doc)

pandas/core/groupby/groupby.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class providing the base-class of operations.
4242
from pandas.core.sorting import get_group_index_sorter
4343

4444
_doc_template = """
45-
4645
See Also
4746
--------
4847
pandas.Series.%(name)s
@@ -1049,7 +1048,8 @@ def any(self, skipna=True):
10491048
@Substitution(name='groupby')
10501049
@Appender(_doc_template)
10511050
def all(self, skipna=True):
1052-
"""Returns True if all values in the group are truthful, else False
1051+
"""
1052+
Returns True if all values in the group are truthful, else False
10531053
10541054
Parameters
10551055
----------

pandas/core/indexes/base.py

-7
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,6 @@ def to_frame(self, index=True, name=None):
12241224
or the original Index is returned.
12251225
12261226
.. versionadded:: 0.19.0
1227-
12281227
"""
12291228

12301229
@Appender(_index_shared_docs['astype'])
@@ -2539,7 +2538,6 @@ def asof_locs(self, where, mask):
25392538
"""
25402539
where : array of timestamps
25412540
mask : array of booleans where data is not NA
2542-
25432541
"""
25442542
locs = self.values[mask].searchsorted(where.values, side='right')
25452543

@@ -2785,7 +2783,6 @@ def union(self, other):
27852783
>>> idx2 = pd.Index([3, 4, 5, 6])
27862784
>>> idx1.union(idx2)
27872785
Int64Index([1, 2, 3, 4, 5, 6], dtype='int64')
2788-
27892786
"""
27902787
self._assert_can_do_setop(other)
27912788
other = ensure_index(other)
@@ -2884,7 +2881,6 @@ def intersection(self, other):
28842881
>>> idx2 = pd.Index([3, 4, 5, 6])
28852882
>>> idx1.intersection(idx2)
28862883
Int64Index([3, 4], dtype='int64')
2887-
28882884
"""
28892885
self._assert_can_do_setop(other)
28902886
other = ensure_index(other)
@@ -2956,7 +2952,6 @@ def difference(self, other, sort=True):
29562952
Int64Index([1, 2], dtype='int64')
29572953
>>> idx1.difference(idx2, sort=False)
29582954
Int64Index([2, 1], dtype='int64')
2959-
29602955
"""
29612956
self._assert_can_do_setop(other)
29622957

@@ -3342,7 +3337,6 @@ def droplevel(self, level=0):
33423337
33433338
Notice that the return value is an array of locations in ``index``
33443339
and ``x`` is marked by -1, as it is not in ``index``.
3345-
33463340
"""
33473341

33483342
@Appender(_index_shared_docs['get_indexer'] % _index_doc_kwargs)
@@ -4374,7 +4368,6 @@ def get_slice_bound(self, label, side, kind):
43744368
label : object
43754369
side : {'left', 'right'}
43764370
kind : {'ix', 'loc', 'getitem'}
4377-
43784371
"""
43794372
assert kind in ['ix', 'loc', 'getitem', None]
43804373

pandas/core/indexes/category.py

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
typ='method', overwrite=True)
4343
class CategoricalIndex(Index, accessor.PandasDelegate):
4444
"""
45-
4645
Immutable Index implementing an ordered, sliceable set. CategoricalIndex
4746
represents a sparsely populated Index with an underlying Categorical.
4847

pandas/core/indexes/datetimes.py

-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ class DatetimeIndex(DatetimeArray, DatelikeOps, TimelikeOps,
167167
TimedeltaIndex : Index of timedelta64 data.
168168
PeriodIndex : Index of Period data.
169169
pandas.to_datetime : Convert argument to datetime.
170-
171170
"""
172171
_typ = 'datetimeindex'
173172
_join_precedence = 10
@@ -546,7 +545,6 @@ def to_series(self, keep_tz=None, index=None, name=None):
546545
def snap(self, freq='S'):
547546
"""
548547
Snap time stamps to nearest occurring frequency
549-
550548
"""
551549
# Superdumb, punting on any optimizing
552550
freq = to_offset(freq)

pandas/core/indexes/multi.py

-4
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ def set_levels(self, levels, level=None, inplace=False,
356356
-------
357357
new index (of same type and class...etc)
358358
359-
360359
Examples
361360
--------
362361
>>> idx = pd.MultiIndex.from_tuples([(1, u'one'), (1, u'two'),
@@ -1519,7 +1518,6 @@ def remove_unused_levels(self):
15191518
MultiIndex(levels=[[0, 1], ['a', 'b']],
15201519
labels=[[0, 0, 1, 1], [0, 1, 0, 1]])
15211520
1522-
15231521
>>> i[2:]
15241522
MultiIndex(levels=[[0, 1], ['a', 'b']],
15251523
labels=[[1, 1], [0, 1]])
@@ -1530,7 +1528,6 @@ def remove_unused_levels(self):
15301528
>>> i[2:].remove_unused_levels()
15311529
MultiIndex(levels=[[1], ['a', 'b']],
15321530
labels=[[0, 0], [0, 1]])
1533-
15341531
"""
15351532

15361533
new_levels = []
@@ -1912,7 +1909,6 @@ def sortlevel(self, level=0, ascending=True, sort_remaining=True):
19121909
Resulting index
19131910
indexer : np.ndarray
19141911
Indices of output values in original index
1915-
19161912
"""
19171913
from pandas.core.sorting import indexer_from_factorized
19181914

pandas/core/panel.py

-3
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,6 @@ def major_xs(self, key):
806806
MultiIndex Slicers is a generic way to get/set values on any level or
807807
levels and is a superset of major_xs functionality, see
808808
:ref:`MultiIndex Slicers <advanced.mi_slicers>`
809-
810809
"""
811810
return self.xs(key, axis=self._AXIS_LEN - 2)
812811

@@ -831,7 +830,6 @@ def minor_xs(self, key):
831830
MultiIndex Slicers is a generic way to get/set values on any level or
832831
levels and is a superset of minor_xs functionality, see
833832
:ref:`MultiIndex Slicers <advanced.mi_slicers>`
834-
835833
"""
836834
return self.xs(key, axis=self._AXIS_LEN - 1)
837835

@@ -856,7 +854,6 @@ def xs(self, key, axis=1):
856854
MultiIndex Slicers is a generic way to get/set values on any level or
857855
levels and is a superset of xs functionality, see
858856
:ref:`MultiIndex Slicers <advanced.mi_slicers>`
859-
860857
"""
861858
axis = self._get_axis_number(axis)
862859
if axis == 0:

pandas/core/resample.py

-3
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def __iter__(self):
110110
See Also
111111
--------
112112
GroupBy.__iter__
113-
114113
"""
115114
self._set_binner()
116115
return super(Resampler, self).__iter__()
@@ -204,7 +203,6 @@ def pipe(self, func, *args, **kwargs):
204203
return super(Resampler, self).pipe(func, *args, **kwargs)
205204

206205
_agg_doc = dedent("""
207-
208206
Examples
209207
--------
210208
>>> s = pd.Series([1,2,3,4,5],
@@ -244,7 +242,6 @@ def pipe(self, func, *args, **kwargs):
244242
pandas.DataFrame.groupby.aggregate
245243
pandas.DataFrame.resample.transform
246244
pandas.DataFrame.aggregate
247-
248245
""")
249246

250247
@Appender(_agg_doc)

pandas/core/reshape/merge.py

-3
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ def merge_ordered(left, right, on=None,
203203
--------
204204
merge
205205
merge_asof
206-
207206
"""
208207
def _merger(x, y):
209208
# perform the ordered merge operation
@@ -312,7 +311,6 @@ def merge_asof(left, right, on=None,
312311
313312
.. versionadded:: 0.20.0
314313
315-
316314
Returns
317315
-------
318316
merged : DataFrame
@@ -451,7 +449,6 @@ def merge_asof(left, right, on=None,
451449
--------
452450
merge
453451
merge_ordered
454-
455452
"""
456453
op = _AsOfMerge(left, right,
457454
on=on, left_on=left_on, right_on=right_on,

pandas/core/reshape/pivot.py

-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ def crosstab(index, columns, values=None, rownames=None, colnames=None,
433433
434434
.. versionadded:: 0.18.1
435435
436-
437436
Notes
438437
-----
439438
Any Series passed will have their name attributes used unless row or column

pandas/core/util/hashing.py

-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def hash_pandas_object(obj, index=True, encoding='utf8', hash_key=None,
6969
Returns
7070
-------
7171
Series of uint64, same length as the object
72-
7372
"""
7473
from pandas import Series
7574
if hash_key is None:
@@ -248,7 +247,6 @@ def hash_array(vals, encoding='utf8', hash_key=None, categorize=True):
248247
Returns
249248
-------
250249
1d uint64 numpy array of hash values, same length as the vals
251-
252250
"""
253251

254252
if not hasattr(vals, 'dtype'):

pandas/core/window.py

-5
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,6 @@ def _validate_freq(self):
16131613
8 -0.289082 2.454418 1.416871
16141614
9 0.212668 0.403198 -0.093924
16151615
1616-
16171616
>>> df.rolling(3).agg({'A':'sum', 'B':'min'})
16181617
A B
16191618
0 NaN NaN
@@ -1631,7 +1630,6 @@ def _validate_freq(self):
16311630
--------
16321631
pandas.Series.rolling
16331632
pandas.DataFrame.rolling
1634-
16351633
""")
16361634

16371635
@Appender(_agg_doc)
@@ -1908,7 +1906,6 @@ def _get_window(self, other=None):
19081906
pandas.DataFrame.expanding.aggregate
19091907
pandas.DataFrame.rolling.aggregate
19101908
pandas.DataFrame.aggregate
1911-
19121909
""")
19131910

19141911
@Appender(_agg_doc)
@@ -2209,7 +2206,6 @@ def _constructor(self):
22092206
See Also
22102207
--------
22112208
pandas.DataFrame.rolling.aggregate
2212-
22132209
""")
22142210

22152211
@Appender(_agg_doc)
@@ -2233,7 +2229,6 @@ def _apply(self, func, **kwargs):
22332229
Returns
22342230
-------
22352231
y : same type as input argument
2236-
22372232
"""
22382233
blocks, obj, index = self._create_blocks()
22392234
results = []

pandas/errors/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class UnsortedIndexError(KeyError):
2626
and the index has not been lexsorted. Subclass of `KeyError`.
2727
2828
.. versionadded:: 0.20.0
29-
3029
"""
3130

3231

pandas/io/formats/style.py

-3
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,6 @@ def applymap(self, func, subset=None, **kwargs):
637637
See Also
638638
--------
639639
Styler.where
640-
641640
"""
642641
self._todo.append((lambda instance: getattr(instance, '_applymap'),
643642
(func, subset), kwargs))
@@ -672,7 +671,6 @@ def where(self, cond, value, other=None, subset=None, **kwargs):
672671
See Also
673672
--------
674673
Styler.applymap
675-
676674
"""
677675

678676
if other is None:
@@ -1104,7 +1102,6 @@ def bar(self, subset=None, axis=0, color='#d65f5f', width=100,
11041102
11051103
.. versionadded:: 0.24.0
11061104
1107-
11081105
Returns
11091106
-------
11101107
self : Styler

pandas/io/json/normalize.py

-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ def json_normalize(data, record_path=None, meta=None,
129129
130130
.. versionadded:: 0.20.0
131131
132-
133132
Returns
134133
-------
135134
frame : DataFrame

pandas/io/packers.py

-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ def read_msgpack(path_or_buf, encoding='utf-8', iterator=False, **kwargs):
177177
Returns
178178
-------
179179
obj : same type as object stored in file
180-
181180
"""
182181
path_or_buf, _, _, should_close = get_filepath_or_buffer(path_or_buf)
183182
if iterator:

0 commit comments

Comments
 (0)