From 452cd99f73b253ef5a764096fbdb00d17c1e2c1e Mon Sep 17 00:00:00 2001 From: Armin Berres Date: Mon, 25 Jun 2018 16:08:57 +0200 Subject: [PATCH] DOC: Do no use 'type' as first word when specifying a return type (#21622) Pycharm is otherwise confused and expects objects of type 'type' to be returned. --- pandas/core/frame.py | 2 +- pandas/core/generic.py | 28 ++++++++++++++-------------- pandas/core/groupby/groupby.py | 2 +- pandas/core/sparse/series.py | 2 +- pandas/core/window.py | 4 ++-- pandas/io/packers.py | 2 +- pandas/io/pickle.py | 2 +- pandas/io/pytables.py | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 74bb2abc27c4b..34d3eb0a6db73 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -4675,7 +4675,7 @@ def swaplevel(self, i=-2, j=-1, axis=0): Returns ------- - swapped : type of caller (new object) + swapped : same type as caller (new object) .. versionchanged:: 0.18.1 diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 04ba0b5de3f7f..4efdd3812accd 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -800,7 +800,7 @@ def swaplevel(self, i=-2, j=-1, axis=0): Returns ------- - swapped : type of caller (new object) + swapped : same type as caller (new object) .. versionchanged:: 0.18.1 @@ -1073,7 +1073,7 @@ def _set_axis_name(self, name, axis=0, inplace=False): Returns ------- - renamed : type of caller or None if inplace=True + renamed : same type as caller or None if inplace=True See Also -------- @@ -2468,7 +2468,7 @@ def get(self, key, default=None): Returns ------- - value : type of items contained in object + value : same type as items contained in object """ try: return self[key] @@ -2768,7 +2768,7 @@ def __delitem__(self, key): Returns ------- - taken : type of caller + taken : same type as caller An array-like containing the elements taken from the object. See Also @@ -2824,7 +2824,7 @@ def _take(self, indices, axis=0, is_copy=True): Returns ------- - taken : type of caller + taken : same type as caller An array-like containing the elements taken from the object. See Also @@ -3033,7 +3033,7 @@ def select(self, crit, axis=0): Returns ------- - selection : type of caller + selection : same type as caller """ warnings.warn("'select' is deprecated and will be removed in a " "future release. You can use " @@ -3924,7 +3924,7 @@ def head(self, n=5): Returns ------- - obj_head : type of caller + obj_head : same type as caller The first `n` rows of the caller object. See Also @@ -4447,7 +4447,7 @@ def _consolidate(self, inplace=False): Returns ------- - consolidated : type of caller + consolidated : same type as caller """ inplace = validate_bool_kwarg(inplace, 'inplace') if inplace: @@ -4916,7 +4916,7 @@ def astype(self, dtype, copy=True, errors='raise', **kwargs): Returns ------- - casted : type of caller + casted : same type as caller Examples -------- @@ -6691,7 +6691,7 @@ def asfreq(self, freq, method=None, how=None, normalize=False, Returns ------- - converted : type of caller + converted : same type as caller Examples -------- @@ -6772,7 +6772,7 @@ def at_time(self, time, asof=False): Returns ------- - values_at_time : type of caller + values_at_time : same type as caller Examples -------- @@ -6826,7 +6826,7 @@ def between_time(self, start_time, end_time, include_start=True, Returns ------- - values_between_time : type of caller + values_between_time : same type as caller Examples -------- @@ -7145,7 +7145,7 @@ def first(self, offset): Returns ------- - subset : type of caller + subset : same type as caller See Also -------- @@ -7209,7 +7209,7 @@ def last(self, offset): Returns ------- - subset : type of caller + subset : same type as caller See Also -------- diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index 0bbdfbbe52ac4..c69d7f43de8ea 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -867,7 +867,7 @@ def get_group(self, name, obj=None): Returns ------- - group : type of obj + group : same type as obj """ if obj is None: obj = self._selected_obj diff --git a/pandas/core/sparse/series.py b/pandas/core/sparse/series.py index 714cd09a27294..09d958059d355 100644 --- a/pandas/core/sparse/series.py +++ b/pandas/core/sparse/series.py @@ -398,7 +398,7 @@ def abs(self): Returns ------- - abs: type of caller + abs: same type as caller """ return self._constructor(np.abs(self.values), index=self.index).__finalize__(self) diff --git a/pandas/core/window.py b/pandas/core/window.py index 9d0f9dc4f75f9..f089e402261db 100644 --- a/pandas/core/window.py +++ b/pandas/core/window.py @@ -665,7 +665,7 @@ def _apply_window(self, mean=True, **kwargs): Returns ------- - y : type of input argument + y : same type as input argument """ window = self._prep_window(**kwargs) @@ -2139,7 +2139,7 @@ def _apply(self, func, **kwargs): Returns ------- - y : type of input argument + y : same type as input argument """ blocks, obj, index = self._create_blocks() diff --git a/pandas/io/packers.py b/pandas/io/packers.py index f9b1d1574d45c..03a5e8528f72d 100644 --- a/pandas/io/packers.py +++ b/pandas/io/packers.py @@ -178,7 +178,7 @@ def read_msgpack(path_or_buf, encoding='utf-8', iterator=False, **kwargs): Returns ------- - obj : type of object stored in file + obj : same type as object stored in file """ path_or_buf, _, _, should_close = get_filepath_or_buffer(path_or_buf) diff --git a/pandas/io/pickle.py b/pandas/io/pickle.py index d27735fbca318..d347d76c33e0f 100644 --- a/pandas/io/pickle.py +++ b/pandas/io/pickle.py @@ -103,7 +103,7 @@ def read_pickle(path, compression='infer'): Returns ------- - unpickled : type of object stored in file + unpickled : same type as object stored in file See Also -------- diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index aad387e0cdd58..580c7923017e5 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -687,7 +687,7 @@ def get(self, key): Returns ------- - obj : type of object stored in file + obj : same type as object stored in file """ group = self.get_node(key) if group is None: