File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,54 @@ def infer_dtype(object value):
254254 ------
255255 TypeError if ndarray-like but cannot infer the dtype
256256
257+ Notes
258+ -----
259+ - 'mixed' is the catchall for anything that is not otherwise
260+ specialized
261+ - 'mixed-integer-float' are floats and integers
262+ - 'mixed-integer' are integers mixed with non-integers
263+
264+ Examples
265+ --------
266+ >>> infer_dtype(['foo', 'bar'])
267+ 'string'
268+
269+ >>> infer_dtype([b'foo', b'bar'])
270+ 'bytes'
271+
272+ >>> infer_dtype([1, 2, 3])
273+ 'integer'
274+
275+ >>> infer_dtype([1, 2, 3.5])
276+ 'mixed-integer-float'
277+
278+ >>> infer_dtype([1.0, 2.0, 3.5])
279+ 'floating'
280+
281+ >>> infer_dtype(['a', 1])
282+ 'mixed-integer'
283+
284+ >>> infer_dtype([True, False])
285+ 'boolean'
286+
287+ >>> infer_dtype([True, False, np.nan])
288+ 'mixed'
289+
290+ >>> infer_dtype([pd.Timestamp('20130101')])
291+ 'datetime'
292+
293+ >>> infer_dtype([datetime.date(2013, 1, 1)])
294+ 'date'
295+
296+ >>> infer_dtype([np.datetime64('2013-01-01')])
297+ 'datetime64'
298+
299+ >>> infer_dtype([datetime.timedelta(0, 1, 1)])
300+ 'timedelta'
301+
302+ >>> infer_dtype(pd.Series(list('aabc')).astype('category'))
303+ 'categorical'
304+
257305 """
258306
259307 cdef:
You can’t perform that action at this time.
0 commit comments