Absolute number is coming with decimals using pandas

Viewed 25

I'm using pandas to apply some format level changes on a csv and storing the result in a target file. The source file has some integers, but after pandas operation the integers are converted to decimals. For e.g. 3 in source file converted to 3.0. I would like the integers remain as integers.

Any pointers on how to get this working? Will be really helpful, thank you!

import pandas as pd
  
# reading the csv file
df = pd.read_csv(source)
  
# updating the column value/data
df['Regular'] = df['Regular'].replace({',': '_,'})
  
# writing into the file
df.to_csv(target, index=False)
1 Answers
Related