On Fri, Apr 27, 2012 at 21:52, Travis Vaught <tra...@vaught.net> wrote: > With NumPy 1.6.1 (from EPD 7.2-2) I get this behavior: > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > In [1]: import numpy as np > > In [2]: schema = np.dtype({'names':['symbol', 'date', 'open', 'high', 'low', > ...: 'close', 'volume', 'adjclose'], > ...: 'formats':['S8', 'M8', float, float, float, > float, > ...: float, float]}) > > In [3]: data = [("AAPL", "2012-04-12", 600.0, 605.0, 598.0, 602.0, 50000000, > 602.0),] > > In [4]: recdata = np.array(data, dtype=schema) > > In [5]: recdata > Out[5]: > array([ ('AAPL', datetime.datetime(2012, 4, 12, 0, 0), 600.0, 605.0, 598.0, > 602.0, 50000000.0, 602.0)], > dtype=[('symbol', '|S8'), ('date', ('<M8[us]', {})), ('open', '<f8'), > ('high', '<f8'), ('low', '<f8'), ('close', '<f8'), ('volume', '<f8'), > ('adjclose', '<f8')]) > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > With numpy-1.7.0.dev_3cb783e I get this: > >>>> import numpy as np > >>>> schema = >>>> np.dtype({'names':['symbol','data','open','high','low','close','volume','adjclose'], >>>> 'formats':['S8','M8',float,float,float,float,float,float]}) > >>>> data = [("AAPL", "2012-04-12", 600.0, 605.0, 598.0, 602.0, 50000000, >>>> 602.0),] > >>>> recdata = np.array(data, dtype=schema) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ValueError: Cannot create a NumPy datetime other than NaT with generic units > >>>> np.version.version > '1.7.0.dev-3cb783e' > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Any hints about a regression I can check for? Or perhaps I missed an api > change for specifying datetime dtypes?
Judging from the error message, it looks like an intentional API change. -- Robert Kern _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion