diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index 408a52e0526ee..856e36fc24202 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -842,6 +842,7 @@ Deprecations - ``pandas.tseries.plotting.tsplot`` is deprecated. Use :func:`Series.plot` instead (:issue:`18627`) - ``Index.summary()`` is deprecated and will be removed in a future version (:issue:`18217`) - ``NDFrame.get_ftype_counts()`` is deprecated and will be removed in a future version (:issue:`18243`) +- The ``convert_datetime64`` parameter in :func:`DataFrame.to_records` has been deprecated and will be removed in a future version. The NumPy bug motivating this parameter has been resolved. The default value for this parameter has also changed from ``True`` to ``None`` (:issue:`18160`). .. _whatsnew_0230.prior_deprecations: diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 9e57579ddfc05..7c0e367e74ffa 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1311,7 +1311,7 @@ def from_records(cls, data, index=None, exclude=None, columns=None, return cls(mgr) - def to_records(self, index=True, convert_datetime64=True): + def to_records(self, index=True, convert_datetime64=None): """ Convert DataFrame to a NumPy record array. @@ -1322,7 +1322,9 @@ def to_records(self, index=True, convert_datetime64=True): ---------- index : boolean, default True Include index in resulting record array, stored in 'index' field. - convert_datetime64 : boolean, default True + convert_datetime64 : boolean, default None + .. deprecated:: 0.23.0 + Whether to convert the index to datetime.datetime if it is a DatetimeIndex. @@ -1376,6 +1378,13 @@ def to_records(self, index=True, convert_datetime64=True): ('2018-01-01T09:01:00.000000000', 2, 0.75)], dtype=[('index', '