Skip to content Skip to sidebar Skip to footer

Pandas.to_csv Outputs A Column Of Floats Instead Of Integers

I'm working on project involving querying data from a dataframe, performing a few operations on it and then storing it in a csv. Here is the stripped-down code. get_value() is a

Solution 1:

you can change the 'floats' to 'int' via the 'astype' method:

df['id'] =df['id'].astype(int)

Post a Comment for "Pandas.to_csv Outputs A Column Of Floats Instead Of Integers"