30
30
"Float64" ,
31
31
"Float32" ,
32
32
"Bool" ,
33
+ "is_dtype" ,
33
34
]
34
35
35
36
@@ -177,3 +178,36 @@ class Float32:
177
178
178
179
class Bool :
179
180
"""Boolean type with 8 bits of precision."""
181
+
182
+
183
+ def is_dtype (dtype : Any , kind : str | tuple [str , ...]) -> bool :
184
+ """
185
+ Returns a boolean indicating whether a provided dtype is of a specified data type “kind”.
186
+
187
+ Parameters
188
+ ----------
189
+ dtype: Any
190
+ The input dtype.
191
+ kind: str
192
+ data type kind.
193
+ The function must return a boolean indicating whether
194
+ the input dtype is of a specified data type kind.
195
+ The following dtype kinds must be supported:
196
+ - 'bool': boolean data type (Bool).
197
+ - 'signed integer': signed integer data types (Int8, Int16, Int32, Int64).
198
+ - 'unsigned integer': unsigned integer data types (UInt8, UInt16, UInt32, UInt64).
199
+ - 'temporal': temporal data types (Date, Datetime, Duration).
200
+ - 'string': string data type (String).
201
+ - 'floating': floating-point data types (Float32, Float64).
202
+ - 'integral': integer data types. Shorthand for ('signed integer', 'unsigned integer').
203
+ - 'numeric': numeric data types. Shorthand for ('integral', 'floating').
204
+
205
+ If kind is a tuple, the tuple specifies a union of dtypes and/or kinds,
206
+ and the function must return a boolean indicating whether the input dtype
207
+ is either equal to a specified dtype or belongs to at least one specified
208
+ data type kind.
209
+
210
+ Returns
211
+ -------
212
+ bool
213
+ """
0 commit comments