arrays - Python (scipy) import time from text file -
i have text file: 2010-05-16 2010-09-26 2011-04-28 each line string: yyyy-mm-dd my goal read text file , write information array. import scipy sp x=sp.empty(200,ftype=sp.datetime64) file=open(place,'r') p in file: x[i]=p but not work. see "an error". how can solve task? know can use panda need write scipy array. try this: import numpy np x = np.empty(200, dtype='datetime64[d]') open(place, 'r') f: i, date in enumerate(f): x[i] = date.strip() firstly, it's dtype , not ftype . then, need use datetime64[d] since date, not date , time. then, date has newline @ end, results in parse error ( strip() fixes this). might want use np.zeros() instead of np.empty() . you can access these methods through scipy well, they're technically part of numpy, use import numpy np .