pydata/pandas — pull request #3516 by jreback (2013-05-02 18:46:25+00:00)
Title: BUG/CLN: datetime64/timedelta64

Various bugs related to datetime64s

- Properly convert np.datetime64 objects in a Series (GH3416_)

This would convert to object dtype previously
```
In [1]: dates = [
...: np.datetime64(datetime.date(2013, 1, 1)),
...: np.datetime64(datetime.date(2013, 1, 2)),
...: np.datetime64(datetime.date(2013, 1, 3)),
...: ]

In [2]: s = pd.Series(dates)

In [3]: s
Out[3]:
0 2013-01-01 00:00:00
1 2013-01-02 00:00:00
2 2013-01-03 00:00:00
dtype: datetime64[ns]
```

- Do not allow astypes on ``datetime64[ns]`` except to ``object``, and
``timedelta64[ns]`` to ``object/int`` (GH3425_)
- Do not allow datetimelike/timedeltalike creation except with valid types
(e.g. cannot pass ``datetime64[ms]``) (GH3423_)

Any creation/astype of a datetimelike to a non accepted dtype will raise
```
In [6]: Series([Timestamp('20130101'),Timestamp('20130102')],dtype='datetime64[s]')
TypeError: cannot convert datetimelike to dtype [datetime64[s]]
```