Code Sample, a copy-pastable example if possible

import datetime
import pandas as pd

df = pd.DataFrame()
df['string_date'] = ['2015-01-01', '']
df['timestamp'] = df.string_date.values.astype("datetime64[M]")
df.loc[df.timestamp.isnull(), 'timestamp'] = datetime.datetime.max

Error

OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 9999-12-31 23:59:59

Expected Output

No error

output of pd.show_versions()

INSTALLED VERSIONS

commit: None python: 2.7.11.final.0 python-bits: 64 OS: Linux OS-release: 4.5.0-2-amd64 machine: x86_64 processor: byteorder: little LC_ALL: None LANG: en_US.UTF-8

pandas: 0.18.0 nose: 1.3.7 pip: 8.1.2 setuptools: 20.10.1 Cython: 0.24 numpy: 1.11.0 scipy: 0.17.1 statsmodels: None xarray: None IPython: 4.0.3 sphinx: 1.3.6 patsy: 0.4.1 dateutil: 2.4.2 pytz: 2015.7 blosc: None bottleneck: None tables: 3.2.2 numexpr: 2.5.2 matplotlib: 1.5.1 openpyxl: 2.3.0 xlrd: 0.9.4 xlwt: 0.7.5 xlsxwriter: 0.7.3 lxml: 3.6.0 bs4: 4.4.1 html5lib: 0.999 httplib2: 0.9.1 apiclient: None sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.8 boto: None

Comment From: jreback

right out of the docs: http://pandas.pydata.org/pandas-docs/stable/timeseries.html#representing-out-of-bounds-spans

Comment From: benjello

Thanks and sorry for the disturbance.