File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 9
9
from pandas import compat , lib , tslib , _np_version_under1p8
10
10
from pandas .types .cast import _maybe_promote
11
11
from pandas .types .generic import ABCSeries , ABCIndex
12
- from pandas .types .common import (is_integer_dtype ,
12
+ from pandas .types .common import (is_unsigned_integer_dtype ,
13
+ is_signed_integer_dtype ,
14
+ is_integer_dtype ,
13
15
is_int64_dtype ,
14
16
is_categorical_dtype ,
15
17
is_extension_type ,
@@ -471,9 +473,12 @@ def _value_counts_arraylike(values, dropna=True):
471
473
if is_period_type :
472
474
keys = PeriodIndex ._simple_new (keys , freq = freq )
473
475
474
- elif is_integer_dtype (dtype ):
476
+ elif is_signed_integer_dtype (dtype ):
475
477
values = _ensure_int64 (values )
476
478
keys , counts = htable .value_count_int64 (values , dropna )
479
+ elif is_unsigned_integer_dtype (dtype ):
480
+ values = _ensure_uint64 (values )
481
+ keys , counts = htable .value_count_uint64 (values , dropna )
477
482
elif is_float_dtype (dtype ):
478
483
values = _ensure_float64 (values )
479
484
keys , counts = htable .value_count_float64 (values , dropna )
Original file line number Diff line number Diff line change @@ -155,6 +155,18 @@ def is_integer_dtype(arr_or_dtype):
155
155
not issubclass (tipo , (np .datetime64 , np .timedelta64 )))
156
156
157
157
158
+ def is_signed_integer_dtype (arr_or_dtype ):
159
+ tipo = _get_dtype_type (arr_or_dtype )
160
+ return (issubclass (tipo , np .signedinteger ) and
161
+ not issubclass (tipo , (np .datetime64 , np .timedelta64 )))
162
+
163
+
164
+ def is_unsigned_integer_dtype (arr_or_dtype ):
165
+ tipo = _get_dtype_type (arr_or_dtype )
166
+ return (issubclass (tipo , np .unsignedinteger ) and
167
+ not issubclass (tipo , (np .datetime64 , np .timedelta64 )))
168
+
169
+
158
170
def is_int64_dtype (arr_or_dtype ):
159
171
tipo = _get_dtype_type (arr_or_dtype )
160
172
return issubclass (tipo , np .int64 )
You can’t perform that action at this time.
0 commit comments