Infer Decimal dtype (original) (raw)
In [15]: from decimal import Decimal
In [16]: s = pd.Series([Decimal(3), Decimal(1), Decimal(4)]) ...: s Out[16]: 0 3 1 1 2 4 dtype: object
In [17]: s.dtype Out[17]: dtype('O')
In [18]: pd.lib.infer_dtype(s) Out[18]: 'mixed'
In [19]: set(map(type, s)) Out[19]: {decimal.Decimal}
It would be nice if the infer_dtype function could determine if the column was all of decimal type which could be useful when working with databases which return data as decimal types