I'm new to Python so I'm sorry in advance if my question is basic.
I've got a CSV table that I imported using this code (I found this code on a post from StackOverflow):
import csv
with open('myCSV.csv', 'r') as csvfile:
so = csv.reader(csvfile, delimiter=',', quotechar='"')
so_data = []
for row in so:
so_data.append(row)
When I run so_data[1:][1]
, I get this: ['1.25;10.25;1.25;5.25']
I would rather like to get this: [1.25,10.25,1.25,5.25]
, so I can use this vector in an input for a Python function I'm using.
How can I get this? Thanks a lot for any suggestion.
I tried other ways such as importing CSV with myCSV=pd.read_csv(r'myCSV.csv')
, using myCSV.iloc[[0]]
and myCSV.iloc[0].values
and myCSV.to_numpy()[0]
but I dont get the vector format I need.
EDIT My data looks like that in the csv file:
a;b;c;d
1.25;10.25;1.25;5.25
11.25;2.25;1.25;5.25
1.25;1.25;10.25;7.25
(NB: I tried to save the data in all the CSV formats allowed by Excel but I still could not get the vector format I need.)