Reputation: 352
So, I have python script that convert a .xls or a .xlsx file into a csv:
df = pd.read_excel(input_name, sheet_name)
df.to_csv(output_name, sep=';', index=False, quotechar='\'', decimal='')
During the conversion, the data of the input_name file where the value was an integer become the same integer with an extra '0' at the end. And the float values (represented like this: 10,0548415184 for example but with variable length) loses there separator (,) and become an int with extra 0s as well.
As an example this input:
1000 98,762154966389 0,00 0,00 98,76 ABC_NAME
Will become:
10000 9876215496638900 0 0 9876215496638900 ABC_NAME
Why? How can I solve this?
desired output should be the same as the input (but in csv rather than xls / xlsx)
EDIT: nuriselcuk gave me the answer and now it works fine.
Thanks !
code should be:
df.to_csv(output_name, sep=';', index=False, quotechar='\'', decimal=',')
Upvotes: 0
Views: 66