Advertisement
FiddleComputers

julia csv

May 20th, 2021
772
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. import csv
  2.  
  3. data = []
  4.  
  5. with open('test.csv', newline='') as csvfile:
  6.     csvreader = csv.reader(csvfile, delimiter=',', quotechar='"')
  7.     for row in csvreader:
  8.         data_row = []
  9.         for column in row:
  10.             try:
  11.                 data_row.append(float(column.replace(',', '.')))
  12.             except:
  13.                 print("Couldn't convert data. Skipping value.")
  14.         if data_row != []:
  15.             data.append(data_row)
  16.  
  17. pprint.pprint(data)
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement