Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error GL07 #24126

Merged
merged 2 commits into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ def unique(values):
- If the input is a Categorical dtype, the return is a Categorical
- If the input is a Series/ndarray, the return will be an ndarray

See Also
--------
pandas.Index.unique
pandas.Series.unique

Examples
--------
>>> pd.unique(pd.Series([2, 1, 3, 3]))
Expand Down Expand Up @@ -338,11 +343,6 @@ def unique(values):

>>> pd.unique([('a', 'b'), ('b', 'a'), ('a', 'c'), ('b', 'a')])
array([('a', 'b'), ('b', 'a'), ('a', 'c')], dtype=object)

See Also
--------
pandas.Index.unique
pandas.Series.unique
"""

values = _ensure_arraylike(values)
Expand Down
76 changes: 38 additions & 38 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,16 @@ class Categorical(ExtensionArray, PandasObject):
If an explicit ``ordered=True`` is given but no `categories` and the
`values` are not sortable.

See Also
--------
pandas.api.types.CategoricalDtype : Type for categorical data.
CategoricalIndex : An Index with an underlying ``Categorical``.

Notes
-----
See the `user guide
<http://pandas.pydata.org/pandas-docs/stable/categorical.html>`_ for more.

Examples
--------
>>> pd.Categorical([1, 2, 3, 1, 2, 3])
Expand All @@ -293,16 +303,6 @@ class Categorical(ExtensionArray, PandasObject):
Categories (3, object): [c < b < a]
>>> c.min()
'c'

Notes
-----
See the `user guide
<http://pandas.pydata.org/pandas-docs/stable/categorical.html>`_ for more.

See Also
--------
pandas.api.types.CategoricalDtype : Type for categorical data.
CategoricalIndex : An Index with an underlying ``Categorical``.
"""

# For comparisons, so that numpy uses our implementation if the compare
Expand Down Expand Up @@ -827,11 +827,6 @@ def set_categories(self, new_categories, ordered=None, rename=False,
dtypes on python3, which does not considers a S1 string equal to a
single char python string.

Raises
------
ValueError
If new_categories does not validate as categories

Parameters
----------
new_categories : Index-like
Expand All @@ -850,6 +845,11 @@ def set_categories(self, new_categories, ordered=None, rename=False,
-------
cat : Categorical with reordered categories or None if inplace.

Raises
------
ValueError
If new_categories does not validate as categories

See Also
--------
rename_categories
Expand Down Expand Up @@ -882,12 +882,6 @@ def rename_categories(self, new_categories, inplace=False):
"""
Renames categories.

Raises
------
ValueError
If new categories are list-like and do not have the same number of
items than the current categories or do not validate as categories

Parameters
----------
new_categories : list-like, dict-like or callable
Expand Down Expand Up @@ -922,6 +916,12 @@ def rename_categories(self, new_categories, inplace=False):
With ``inplace=False``, the new categorical is returned.
With ``inplace=True``, there is no return value.

Raises
------
ValueError
If new categories are list-like and do not have the same number of
items than the current categories or do not validate as categories

See Also
--------
reorder_categories
Expand Down Expand Up @@ -979,12 +979,6 @@ def reorder_categories(self, new_categories, ordered=None, inplace=False):
`new_categories` need to include all old categories and no new category
items.

Raises
------
ValueError
If the new categories do not contain all old category items or any
new ones

Parameters
----------
new_categories : Index-like
Expand All @@ -1000,6 +994,12 @@ def reorder_categories(self, new_categories, ordered=None, inplace=False):
-------
cat : Categorical with reordered categories or None if inplace.

Raises
------
ValueError
If the new categories do not contain all old category items or any
new ones

See Also
--------
rename_categories
Expand All @@ -1022,12 +1022,6 @@ def add_categories(self, new_categories, inplace=False):
`new_categories` will be included at the last/highest place in the
categories and will be unused directly after this call.

Raises
------
ValueError
If the new categories include old categories or do not validate as
categories

Parameters
----------
new_categories : category or list-like of category
Expand All @@ -1040,6 +1034,12 @@ def add_categories(self, new_categories, inplace=False):
-------
cat : Categorical with new categories added or None if inplace.

Raises
------
ValueError
If the new categories include old categories or do not validate as
categories

See Also
--------
rename_categories
Expand Down Expand Up @@ -1072,11 +1072,6 @@ def remove_categories(self, removals, inplace=False):
`removals` must be included in the old categories. Values which were in
the removed categories will be set to NaN

Raises
------
ValueError
If the removals are not contained in the categories

Parameters
----------
removals : category or list of categories
Expand All @@ -1089,6 +1084,11 @@ def remove_categories(self, removals, inplace=False):
-------
cat : Categorical with removed categories or None if inplace.

Raises
------
ValueError
If the removals are not contained in the categories

See Also
--------
rename_categories
Expand Down
20 changes: 10 additions & 10 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,11 @@ def to_period(self, freq=None):
When converting a DatetimeArray/Index with non-regular values,
so that a frequency cannot be inferred.

See Also
--------
PeriodIndex: Immutable ndarray holding ordinal values.
DatetimeIndex.to_pydatetime: Return DatetimeIndex as object.

Examples
--------
>>> df = pd.DataFrame({"y": [1,2,3]},
Expand All @@ -908,11 +913,6 @@ def to_period(self, freq=None):
>>> idx.to_period()
PeriodIndex(['2017-01-01', '2017-01-02'],
dtype='period[D]', freq='D')

See Also
--------
PeriodIndex: Immutable ndarray holding ordinal values.
DatetimeIndex.to_pydatetime: Return DatetimeIndex as object.
"""
from pandas.core.arrays import PeriodArray

Expand Down Expand Up @@ -1087,17 +1087,17 @@ def date(self):
by 6. This method is available on both Series with datetime
values (using the `dt` accessor) or DatetimeIndex.

Returns
-------
Series or Index
Containing integers indicating the day number.

See Also
--------
Series.dt.dayofweek : Alias.
Series.dt.weekday : Alias.
Series.dt.day_name : Returns the name of the day of the week.

Returns
-------
Series or Index
Containing integers indicating the day number.

Examples
--------
>>> s = pd.date_range('2016-12-31', '2017-01-08', freq='D').to_series()
Expand Down
84 changes: 41 additions & 43 deletions pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,21 @@
set_closed
%(extra_methods)s\

%(examples)s\

Notes
------
See the `user guide
<http://pandas.pydata.org/pandas-docs/stable/advanced.html#intervalindex>`_
for more.

See Also
--------
Index : The base pandas Index type.
Interval : A bounded slice-like interval; the elements of an %(klass)s.
interval_range : Function to create a fixed frequency IntervalIndex.
cut : Bin values into discrete Intervals.
qcut : Bin values into equal-sized Intervals based on rank or sample quantiles.

Notes
------
See the `user guide
<http://pandas.pydata.org/pandas-docs/stable/advanced.html#intervalindex>`_
for more.

%(examples)s\
"""


Expand Down Expand Up @@ -236,18 +236,18 @@ def _from_factorized(cls, values, original):

.. versionadded:: 0.23.0

See Also
--------
interval_range : Function to create a fixed frequency IntervalIndex.
%(klass)s.from_arrays : Construct from a left and right array.
%(klass)s.from_tuples : Construct from a sequence of tuples.

Examples
--------
>>> pd.%(klass)s.from_breaks([0, 1, 2, 3])
%(klass)s([(0, 1], (1, 2], (2, 3]]
closed='right',
dtype='interval[int64]')

See Also
--------
interval_range : Function to create a fixed frequency IntervalIndex.
%(klass)s.from_arrays : Construct from a left and right array.
%(klass)s.from_tuples : Construct from a sequence of tuples.
"""

@classmethod
Expand Down Expand Up @@ -281,14 +281,6 @@ def from_breaks(cls, breaks, closed='right', copy=False, dtype=None):
-------
%(klass)s

Notes
-----
Each element of `left` must be less than or equal to the `right`
element at the same position. If an element is missing, it must be
missing in both `left` and `right`. A TypeError is raised when
using an unsupported type for `left` or `right`. At the moment,
'category', 'object', and 'string' subtypes are not supported.

Raises
------
ValueError
Expand All @@ -304,6 +296,13 @@ def from_breaks(cls, breaks, closed='right', copy=False, dtype=None):
%(klass)s.from_tuples : Construct an %(klass)s from an
array-like of tuples.

Notes
-----
Each element of `left` must be less than or equal to the `right`
element at the same position. If an element is missing, it must be
missing in both `left` and `right`. A TypeError is raised when
using an unsupported type for `left` or `right`. At the moment,
'category', 'object', and 'string' subtypes are not supported.

Examples
--------
Expand Down Expand Up @@ -339,6 +338,16 @@ def from_arrays(cls, left, right, closed='right', copy=False, dtype=None):

..versionadded:: 0.23.0

See Also
--------
interval_range : Function to create a fixed frequency IntervalIndex.
%(klass)s.from_arrays : Construct an %(klass)s from a left and
right array.
%(klass)s.from_breaks : Construct an %(klass)s from an array of
splits.
%(klass)s.from_tuples : Construct an %(klass)s from an
array-like of tuples.

Examples
--------
>>> pd.%(klass)s.from_intervals([pd.Interval(0, 1),
Expand All @@ -352,16 +361,6 @@ def from_arrays(cls, left, right, closed='right', copy=False, dtype=None):
>>> pd.Index([pd.Interval(0, 1), pd.Interval(1, 2)])
%(klass)s([(0, 1], (1, 2]]
closed='right', dtype='interval[int64]')

See Also
--------
interval_range : Function to create a fixed frequency IntervalIndex.
%(klass)s.from_arrays : Construct an %(klass)s from a left and
right array.
%(klass)s.from_breaks : Construct an %(klass)s from an array of
splits.
%(klass)s.from_tuples : Construct an %(klass)s from an
array-like of tuples.
"""

_interval_shared_docs['from_tuples'] = """
Expand All @@ -381,20 +380,19 @@ def from_arrays(cls, left, right, closed='right', copy=False, dtype=None):

..versionadded:: 0.23.0


Examples
--------
>>> pd.%(klass)s.from_tuples([(0, 1), (1, 2)])
%(klass)s([(0, 1], (1, 2]],
closed='right', dtype='interval[int64]')

See Also
--------
interval_range : Function to create a fixed frequency IntervalIndex.
%(klass)s.from_arrays : Construct an %(klass)s from a left and
right array.
%(klass)s.from_breaks : Construct an %(klass)s from an array of
splits.

Examples
--------
>>> pd.%(klass)s.from_tuples([(0, 1), (1, 2)])
%(klass)s([(0, 1], (1, 2]],
closed='right', dtype='interval[int64]')
"""

@classmethod
Expand Down Expand Up @@ -1052,6 +1050,10 @@ def repeat(self, repeats, **kwargs):
ndarray
Boolean array positionally indicating where an overlap occurs.

See Also
--------
Interval.overlaps : Check whether two Interval objects overlap.

Examples
--------
>>> intervals = %(constructor)s.from_tuples([(0, 1), (1, 3), (2, 4)])
Expand All @@ -1071,10 +1073,6 @@ def repeat(self, repeats, **kwargs):

>>> intervals.overlaps(pd.Interval(1, 2, closed='right'))
array([False, True, False])

See Also
--------
Interval.overlaps : Check whether two Interval objects overlap.
"""

@Appender(_interval_shared_docs['overlaps'] % _shared_docs_kwargs)
Expand Down
Loading