I have a text file with two columns of data that are separated by a comma. I am trying to import the data into my python script using numpy loadtext, but I am getting the error: invalid literal for float(): 201.9271,43
All of my data looks like this. How do can I get numpy loadtext to import the data properly?
Here's my code:
import numpy as np
data = np.loadtxt('Ozone_at_Uva_2001.txt', dtype=object)
dct = data[:,0] #DecTime
ppbv = data[:,1] #[O3]ppbv
My text file looks like this except for there are many more data points.
201.9271,43
201.9375,35
201.9479,31
201.9583,35
201.9688,31
201.9792,30
delimiter=','. The default delimiter is white space, not a comma.dtype='object'?