I'm trying to replace the commas with decimal points and then replace the semi-colons with commas in a CSV file.
The CSV file:
# 2018-03-16: ECarbix Prices/Volumes for Emission Spot Market
#  
# Data type(ST);Trading Date;Creation Time
# Data type(IL);Index;Unit;Price;Volume
# Data type(AL);Number of Lines
#  
ST;2018-03-16;2018-03-19T08:39:48+01:00
IL;Day;EUR/tCO2;10,97;4533000
AL;9
The code I tried:
import pandas as pd
from os import walk
import csv
import xml.dom.minidom
from xml.etree import ElementTree
with open('some.csv', 'w', newline='') as fw:
 writer = csv.writer(fw)
 for filenames in walk("D:\EEX_EMS\CSV"):
    (filenames)
    fname= list(filenames)
    for f in fname[2]:
     if "Auction"  not in f:
      #print(f)
      with open('D:/EEX_EMS/CSV/'+f, 'r') as csvfile:
       spamreader = csv.reader(csvfile,  quotechar='|')
       for fg in spamreader:
        fi =str(fg)
        print(fi)
        fi1 = str(fi.replace(',','.'))
        fi2 = str(fi1.replace(';',','))
        fi_list =str(fi2.split(','))
        print (str(fi_list))
        writer.writerow(fi_list)
fw.close()
This is the output:
['# 2018-03-16: ECarbix Prices/Volumes for Emission Spot Market']
['#  ']
['# Data type(ST),Trading Date,Creation Time']
['# Data type(IL),Index,Unit,Price,Volume']
['# Data type(AL),Number of Lines']
['#  ']
['ST,2018-03-16,2018-03-19T08:39:48+01:00']
['IL,Day,EUR/tCO2,10'. '97,4533000']
['AL,9']
How can I get the correct output?
 
     
    