I'm trying to create a Pandas DataFrame from some text data which I'm iterating over (it's a dump of lots of json strings from an API).
Some of the data is small numbers, eg 0.00000001
. I'm using the Python Decimal type for these elsewhere in another app. I'm not sure how to get Pandas to recognise that these are decimals. Whether I create Decimal objects from them first, or create a DataFrame just from the strings, Pandas creates generic object
columns. There are other columns which are different formats.
To take a simple example:
import pandas as pd
df = pd.DataFrame([Decimal('0.01'),])
df.dtypes
Outputs:
0 object
dtype: object
Should I be using the Decimal type? Am I fundamentally misunderstanding something?
Thanks.