Skip to content

Commit 2b4d22b

Browse files
Pradyumna ReddyPradyumna Reddy
Pradyumna Reddy
authored and
Pradyumna Reddy
committed
1 parent ce3b0c3 commit 2b4d22b

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

doc/source/whatsnew/v0.20.2.txt

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Conversion
5959

6060
- Bug in :func:`to_numeric` in which empty data inputs were causing a segfault of the interpreter (:issue:`16302`)
6161
- Silence numpy warnings when broadcasting ``DataFrame`` to ``Series`` with comparison ops (:issue:`16378`, :issue:`16306`)
62+
- Bug in ``Series`` with dtype='category' (:issue:`16524`)
6263

6364

6465
Indexing

pandas/core/categorical.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ class Categorical(PandasObject):
248248
__array_priority__ = 1000
249249
_typ = 'categorical'
250250

251-
def __init__(self, values, categories=None, ordered=False, fastpath=False):
251+
def __init__(self, values, categories=None, ordered=False, fastpath=False,
252+
**kwargs):
252253

253254
self._validate_ordered(ordered)
254255

pandas/tests/series/test_dtypes.py

+8
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,11 @@ def test_intercept_astype_object(self):
248248

249249
result = df.values.squeeze()
250250
assert (result[:, 0] == expected.values).all()
251+
252+
def test_series_to_categorical(self):
253+
series = Series(['a', 'b', 'c'])
254+
255+
categorical_series = Series(series, dtype='category')
256+
expected = Series(['a', 'b', 'c'], dtype='category')
257+
258+
tm.assert_series_equal(categorical_series, expected)

0 commit comments

Comments
 (0)