Skip to content

Commit 83dd40a

Browse files
Pradyumna ReddyPradyumna Reddy
Pradyumna Reddy
authored and
Pradyumna Reddy
committed
1 parent fb47ee5 commit 83dd40a

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
@@ -54,6 +54,7 @@ Conversion
5454

5555
- Bug in ``pd.to_numeric()`` in which empty data inputs were causing Python to crash (:issue:`16302`)
5656
- Silence numpy warnings when broadcasting DataFrame to Series with comparison ops (:issue:`16378`, :issue:`16306`)
57+
- Bug in ``Series`` with dtype='category' (:issue:`16524`)
5758

5859

5960
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)