Skip to content

Infer Decimal dtype #15690

Closed
Closed
@dhirschfeld

Description

@dhirschfeld
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Compatpandas objects compatability with Numpy or Python functionsDtype ConversionsUnexpected or buggy dtype conversionsEnhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions