Skip to content

Commit cf7f51a

Browse files
author
Matt Roeschke
committed
Merge remote-tracking branch 'upstream/master' into format_np_nat_object
2 parents 4a28d12 + c986386 commit cf7f51a

16 files changed

+97
-12
lines changed

ci/deps/azure-27-compat.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies:
2121
- pytest
2222
- pytest-xdist
2323
- pytest-mock
24+
- isort
2425
- pip:
2526
- html5lib==1.0b2
2627
- beautifulsoup4==4.2.1

ci/deps/azure-27-locale.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ dependencies:
2424
- pytest-xdist
2525
- pytest-mock
2626
- hypothesis>=3.58.0
27+
- isort
2728
- pip:
2829
- html5lib==1.0b2
2930
- beautifulsoup4==4.2.1

ci/deps/azure-36-locale_slow.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ dependencies:
3030
- pytest-xdist
3131
- pytest-mock
3232
- moto
33+
- isort
3334
- pip:
3435
- hypothesis>=3.58.0

ci/deps/azure-37-locale.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dependencies:
2828
- pytest
2929
- pytest-xdist
3030
- pytest-mock
31+
- isort
3132
- pip:
3233
- hypothesis>=3.58.0
3334
- moto # latest moto in conda-forge fails with 3.7, move to conda dependencies when this is fixed

ci/deps/azure-37-numpydev.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dependencies:
1010
- pytest-xdist
1111
- pytest-mock
1212
- hypothesis>=3.58.0
13+
- isort
1314
- pip:
1415
- "git+git://github.com/dateutil/dateutil.git"
1516
- "-f https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com"

ci/deps/azure-macos-35.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dependencies:
2525
- pytest
2626
- pytest-xdist
2727
- pytest-mock
28+
- isort
2829
- pip:
2930
- python-dateutil==2.5.3
3031
- hypothesis>=3.58.0

ci/deps/azure-windows-27.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ dependencies:
3030
- pytest-mock
3131
- moto
3232
- hypothesis>=3.58.0
33+
- isort

ci/deps/azure-windows-36.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ dependencies:
2727
- pytest-xdist
2828
- pytest-mock
2929
- hypothesis>=3.58.0
30+
- isort

ci/deps/travis-27.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ dependencies:
4444
- pytest-mock
4545
- moto==1.3.4
4646
- hypothesis>=3.58.0
47+
- isort
4748
- pip:
4849
- backports.lzma
4950
- pandas-gbq

ci/deps/travis-36-doc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ dependencies:
4343
# universal
4444
- pytest
4545
- pytest-xdist
46+
- isort

ci/deps/travis-36-locale.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ dependencies:
3232
- pytest-xdist
3333
- pytest-mock
3434
- moto
35+
- isort
3536
- pip:
3637
- hypothesis>=3.58.0

ci/deps/travis-36-slow.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ dependencies:
3030
- pytest-mock
3131
- moto
3232
- hypothesis>=3.58.0
33+
- isort

ci/deps/travis-36.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ dependencies:
3838
- pytest-cov
3939
- pytest-mock
4040
- hypothesis>=3.58.0
41+
- isort
4142
- pip:
4243
- brotlipy
4344
- coverage

ci/deps/travis-37.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ dependencies:
1717
- pytest-mock
1818
- hypothesis>=3.58.0
1919
- s3fs
20+
- isort
2021
- pip:
2122
- moto

pandas/core/indexes/category.py

Lines changed: 63 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,35 @@
4242
typ='method', overwrite=True)
4343
class CategoricalIndex(Index, accessor.PandasDelegate):
4444
"""
45-
Immutable Index implementing an ordered, sliceable set. CategoricalIndex
46-
represents a sparsely populated Index with an underlying Categorical.
45+
Index based on an underlying :class:`Categorical`.
46+
47+
CategoricalIndex, like Categorical, can only take on a limited,
48+
and usually fixed, number of possible values (`categories`). Also,
49+
like Categorical, it might have an order, but numerical operations
50+
(additions, divisions, ...) are not possible.
4751
4852
Parameters
4953
----------
50-
data : array-like or Categorical, (1-dimensional)
51-
categories : optional, array-like
52-
categories for the CategoricalIndex
53-
ordered : boolean,
54-
designating if the categories are ordered
55-
copy : bool
56-
Make a copy of input ndarray
57-
name : object
58-
Name to be stored in the index
54+
data : array-like (1-dimensional)
55+
The values of the categorical. If `categories` are given, values not in
56+
`categories` will be replaced with NaN.
57+
categories : index-like, optional
58+
The categories for the categorical. Items need to be unique.
59+
If the categories are not given here (and also not in `dtype`), they
60+
will be inferred from the `data`.
61+
ordered : bool, optional
62+
Whether or not this categorical is treated as an ordered
63+
categorical. If not given here or in `dtype`, the resulting
64+
categorical will be unordered.
65+
dtype : CategoricalDtype or the string "category", optional
66+
If :class:`CategoricalDtype`, cannot be used together with
67+
`categories` or `ordered`.
68+
69+
.. versionadded:: 0.21.0
70+
copy : bool, default False
71+
Make a copy of input ndarray.
72+
name : object, optional
73+
Name to be stored in the index.
5974
6075
Attributes
6176
----------
@@ -75,9 +90,45 @@ class CategoricalIndex(Index, accessor.PandasDelegate):
7590
as_unordered
7691
map
7792
93+
Raises
94+
------
95+
ValueError
96+
If the categories do not validate.
97+
TypeError
98+
If an explicit ``ordered=True`` is given but no `categories` and the
99+
`values` are not sortable.
100+
78101
See Also
79102
--------
80-
Categorical, Index
103+
Index : The base pandas Index type.
104+
Categorical : A categorical array.
105+
CategoricalDtype : Type for categorical data.
106+
107+
Notes
108+
-----
109+
See the `user guide
110+
<http://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html#categoricalindex>`_
111+
for more.
112+
113+
Examples
114+
--------
115+
>>> pd.CategoricalIndex(['a', 'b', 'c', 'a', 'b', 'c'])
116+
CategoricalIndex(['a', 'b', 'c', 'a', 'b', 'c'], categories=['a', 'b', 'c'], ordered=False, dtype='category') # noqa
117+
118+
``CategoricalIndex`` can also be instantiated from a ``Categorical``:
119+
120+
>>> c = pd.Categorical(['a', 'b', 'c', 'a', 'b', 'c'])
121+
>>> pd.CategoricalIndex(c)
122+
CategoricalIndex(['a', 'b', 'c', 'a', 'b', 'c'], categories=['a', 'b', 'c'], ordered=False, dtype='category') # noqa
123+
124+
Ordered ``CategoricalIndex`` can have a min and max value.
125+
126+
>>> ci = pd.CategoricalIndex(['a','b','c','a','b','c'], ordered=True,
127+
... categories=['c', 'b', 'a'])
128+
>>> ci
129+
CategoricalIndex(['a', 'b', 'c', 'a', 'b', 'c'], categories=['c', 'b', 'a'], ordered=True, dtype='category') # noqa
130+
>>> ci.min()
131+
'c'
81132
"""
82133

83134
_typ = 'categoricalindex'

setup.cfg

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,23 @@ skip=
152152
asv_bench/benchmarks/dtypes.py
153153
asv_bench/benchmarks/strings.py
154154
asv_bench/benchmarks/period.py
155+
pandas/__init__.py
156+
pandas/plotting/__init__.py
157+
pandas/tests/extension/decimal/__init__.py
158+
pandas/tests/extension/base/__init__.py
159+
pandas/io/msgpack/__init__.py
160+
pandas/io/json/__init__.py
161+
pandas/io/clipboard/__init__.py
162+
pandas/io/excel/__init__.py
163+
pandas/compat/__init__.py
164+
pandas/compat/numpy/__init__.py
165+
pandas/core/arrays/__init__.py
166+
pandas/core/groupby/__init__.py
167+
pandas/core/internals/__init__.py
168+
pandas/api/__init__.py
169+
pandas/api/extensions/__init__.py
170+
pandas/api/types/__init__.py
171+
pandas/_libs/__init__.py
172+
pandas/_libs/tslibs/__init__.py
173+
pandas/util/__init__.py
174+
pandas/arrays/__init__.py

0 commit comments

Comments
 (0)