Skip to content

Commit 6e3537d

Browse files
authored
CLN: Static types in pandas/_lib/lib.pyx (#33329)
1 parent 54f9b03 commit 6e3537d

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

pandas/_libs/lib.pyx

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,34 +1001,34 @@ cdef inline bint c_is_list_like(object obj, bint allow_sets):
10011001

10021002

10031003
_TYPE_MAP = {
1004-
'categorical': 'categorical',
1005-
'category': 'categorical',
1006-
'int8': 'integer',
1007-
'int16': 'integer',
1008-
'int32': 'integer',
1009-
'int64': 'integer',
1010-
'i': 'integer',
1011-
'uint8': 'integer',
1012-
'uint16': 'integer',
1013-
'uint32': 'integer',
1014-
'uint64': 'integer',
1015-
'u': 'integer',
1016-
'float32': 'floating',
1017-
'float64': 'floating',
1018-
'f': 'floating',
1019-
'complex64': 'complex',
1020-
'complex128': 'complex',
1021-
'c': 'complex',
1022-
'string': 'string',
1023-
'S': 'bytes',
1024-
'U': 'string',
1025-
'bool': 'boolean',
1026-
'b': 'boolean',
1027-
'datetime64[ns]': 'datetime64',
1028-
'M': 'datetime64',
1029-
'timedelta64[ns]': 'timedelta64',
1030-
'm': 'timedelta64',
1031-
'interval': 'interval',
1004+
"categorical": "categorical",
1005+
"category": "categorical",
1006+
"int8": "integer",
1007+
"int16": "integer",
1008+
"int32": "integer",
1009+
"int64": "integer",
1010+
"i": "integer",
1011+
"uint8": "integer",
1012+
"uint16": "integer",
1013+
"uint32": "integer",
1014+
"uint64": "integer",
1015+
"u": "integer",
1016+
"float32": "floating",
1017+
"float64": "floating",
1018+
"f": "floating",
1019+
"complex64": "complex",
1020+
"complex128": "complex",
1021+
"c": "complex",
1022+
"string": "string",
1023+
"S": "bytes",
1024+
"U": "string",
1025+
"bool": "boolean",
1026+
"b": "boolean",
1027+
"datetime64[ns]": "datetime64",
1028+
"M": "datetime64",
1029+
"timedelta64[ns]": "timedelta64",
1030+
"m": "timedelta64",
1031+
"interval": "interval",
10321032
}
10331033

10341034
# types only exist on certain platform
@@ -1173,12 +1173,13 @@ cdef class Seen:
11731173
or self.nat_)
11741174

11751175

1176-
cdef _try_infer_map(v):
1176+
cdef object _try_infer_map(object v):
11771177
"""
11781178
If its in our map, just return the dtype.
11791179
"""
11801180
cdef:
1181-
object attr, val
1181+
object val
1182+
str attr
11821183
for attr in ['name', 'kind', 'base']:
11831184
val = getattr(v.dtype, attr)
11841185
if val in _TYPE_MAP:

0 commit comments

Comments
 (0)