Skip to main content
`Ctrl`+`K`

# pandas.DatetimeIndex.to_pydatetime

DatetimeIndex.to_pydatetime()

  Return an ndarray of `datetime.datetime` objects.

  This method converts each element in the DatetimeArray to a native Python `datetime.datetime` object, including timezone information if present.

  Returns:
    numpy.ndarray

      An ndarray of `datetime.datetime` objects.

  See also

  `DatetimeIndex.to_julian_date`

    Converts Datetime Array to float64 ndarray of Julian Dates.

  Examples

      >>> idx = pd.date_range("2018-02-27", periods=3)
      >>> idx.to_pydatetime()
      array([datetime.datetime(2018, 2, 27, 0, 0),
             datetime.datetime(2018, 2, 28, 0, 0),
             datetime.datetime(2018, 3, 1, 0, 0)], dtype=object)