File tree 3 files changed +5
-5
lines changed
3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ Bug Fixes
64
64
- Bug in ``pd.concat`` when empty and non-empty DataFrames or Series are concatenated (:issue:`18178` :issue:`18187`)
65
65
- Bug in :class:`IntervalIndex` constructor when a list of intervals is passed with non-default ``closed`` (:issue:`18334`)
66
66
- Bug in :meth:`IntervalIndex.copy` when copying and ``IntervalIndex`` with non-default ``closed`` (:issue:`18339`)
67
- - Bug in ``pd. read_csv`` when reading numeric category fields with high cardinality (:issue `18186`)
67
+ - Bug in :func:`` read_csv`` when reading numeric category fields with high cardinality (:issue: `18186`)
68
68
69
69
Conversion
70
70
^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -2227,7 +2227,7 @@ def _concatenate_chunks(list chunks):
2227
2227
for name in names:
2228
2228
arrs = [chunk.pop(name) for chunk in chunks]
2229
2229
# Check each arr for consistent types.
2230
- dtypes = set ([ a.dtype for a in arrs])
2230
+ dtypes = { a.dtype for a in arrs}
2231
2231
numpy_dtypes = {x for x in dtypes if not is_categorical_dtype(x)}
2232
2232
if len (numpy_dtypes) > 1 :
2233
2233
common_type = np.find_common_type(numpy_dtypes, [])
Original file line number Diff line number Diff line change @@ -118,11 +118,11 @@ def test_categorical_dtype(self):
118
118
def test_categorical_dtype_high_cardinality_numeric (self ):
119
119
# GH 18186
120
120
data = sorted ([str (i ) for i in range (10 ** 6 )])
121
- expected = pd . DataFrame ({'a' : Categorical (data , ordered = True )})
121
+ expected = DataFrame ({'a' : Categorical (data , ordered = True )})
122
122
actual = self .read_csv (StringIO ('a\n ' + '\n ' .join (data )),
123
123
dtype = 'category' )
124
- actual . a . cat . reorder_categories ( sorted ( actual . a .cat .categories ),
125
- ordered = True , inplace = True )
124
+ actual [ "a" ] = actual [ "a" ] .cat .reorder_categories (
125
+ sorted ( actual . a . cat . categories ), ordered = True )
126
126
tm .assert_frame_equal (actual , expected )
127
127
128
128
def test_categorical_dtype_encoding (self ):
You can’t perform that action at this time.
0 commit comments