I want to convert csv to xlsx and vice versa. It works finde but the € symbol gets cutted out and 5€ gets converted to just 5.
for file_path in self.input_files:
file_name, file_ext = os.path.splitext(file_path)
output_file = os.path.join(self.output_folder, os.path.basename(file_name))
if file_ext.lower() == '.csv':
output_file += '.xlsx'
df = pd.read_csv(file_path, delimiter=';', quotechar='"', decimal=',', encoding='utf-8-sig')
df.to_excel(output_file, index=False)
elif file_ext.lower() == '.xlsx':
output_file += '.csv'
df = pd.read_excel(file_path)
df.to_csv(output_file, index=False, sep=';', quotechar='"', decimal=',', float_format='%.15g', encoding='utf-8-sig')
This is the loop where i convert these files. Any idea how to fix my Problem?
Tried different encodings, and in the manual of pandas i didnt find anything useful
Edit: When i only use €, it will correct be converted to €. But with decimals the € gets cutted out. With the dollar sign instead it works perfect.