I ran into a problem again thats causing me headache for several hours already...and I'm pretty sure it's just a minor thing.
I got a long datafile and created a list with the header names and their types:
col_headers = [('TIMESTAMP','|S21'),('XXX_1','<i8'),('YYY_2','<i8')
After that I created a dictionary variable that holds the options and finally imported it with
bladata = scipy.genfromtxt(datafile, **kwargs)
For extracting time information I used
import datetime as dt
for i in range (0,len(bladata['TIMESTAMP']),1):
datestring = bladata['TIMESTAMP'][i]
#create a datetime object holding dates and times
d = dt.datetime.strptime(datestring, '"%Y-%m-%d %H:%M:%S"')
And finally I assigned the data to a variable by using
XXX = bladata['XXX_1']
YYY = bladata['YYY_2']
(btw when the header name in my datafile is not XXX_1 but XXX(1) instead, I receive the error message "field named XXX(1) not found" - how can I solve this problem as well?)
Now when it comes to plotting, I receive the error message
x and y must have same first dimension
when using the following code
pylab.plot(dt, XXX)
pylab.plot(dt, YYY)
pylab.xlim(d.datetime(2014, 01, 10), d.datetime(2014, 06, 10))
I googled that error message and found a solution that suggested converting a list into a numpy array...but where and which one? I'm pretty sure that isn't a big problem at all, but I couldn't figure it out for several hours...so I'm happy for any usefull reply.
€dit: for clarification...XXX and YYY are 2 different measurements that I want to visualize in 1 plot versus its corresponding date.