pandas datafrme converting some columns to int when it is float code example
Example 1: how to convert a pandas series from int to float in python
df['DataFrame Column'] = df['DataFrame Column'].astype(float)
Example 2: convert float to integer pandas
>>> df
A B C D
0 0.475103 0.355453 0.66 0.869336
1 0.260395 0.200287 NaN 0.617024
2 0.517692 0.735613 0.18 0.657106
>>> df[list("ABCD")] = df[list("ABCD")].fillna(0.0).astype(int)
>>> df
A B C D
0 0 0 0 0
1 0 0 0 0
2 0 0 0 0