How do I define types on loading data in Python ?

bored_panda
bored_panda Registered Posts: 11 ✭✭✭✭
While loading my data, Pandas translates some types wildly, transforming integer to double, strings (with only numbers in it) to decimal, removes leading 0 in strings such as "00042", and so on.

I'd like to set the types of the column while loading the data, to avoid wild type conversion and screwing up my data, how can I do that ?

my_df = dataiku.Dataset("my_data")
# my_df= my_df.get_dataframe(infer_with_pandas=False)
my_df= my_df.get_dataframe()

infer_with_pandas=False didn't work : Job failed : Error in Python process: : Integer column has NA values in column 13. I get what it's telling me, but I do have NAs in some of my columns, and I need to keep them.

Answers

Setup Info
    Tags
      Help me…