Returns numpy array of python :class:`datetime.date` objects. Namely, the date part of Timestamps without time and timezone information. See Also -------- DatetimeIndex.time : Returns numpy array of :class:`datetime.time` objects. The ti
(self)
| 1507 | |
| 1508 | @property |
| 1509 | def date(self) -> npt.NDArray[np.object_]: |
| 1510 | """ |
| 1511 | Returns numpy array of python :class:`datetime.date` objects. |
| 1512 | |
| 1513 | Namely, the date part of Timestamps without time and |
| 1514 | timezone information. |
| 1515 | |
| 1516 | See Also |
| 1517 | -------- |
| 1518 | DatetimeIndex.time : Returns numpy array of :class:`datetime.time` objects. |
| 1519 | The time part of the Timestamps. |
| 1520 | DatetimeIndex.year : The year of the datetime. |
| 1521 | DatetimeIndex.month : The month as January=1, December=12. |
| 1522 | DatetimeIndex.day : The day of the datetime. |
| 1523 | |
| 1524 | Examples |
| 1525 | -------- |
| 1526 | For Series: |
| 1527 | |
| 1528 | >>> s = pd.Series(["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"]) |
| 1529 | >>> s = pd.to_datetime(s) |
| 1530 | >>> s |
| 1531 | 0 2020-01-01 10:00:00+00:00 |
| 1532 | 1 2020-02-01 11:00:00+00:00 |
| 1533 | dtype: datetime64[us, UTC] |
| 1534 | >>> s.dt.date |
| 1535 | 0 2020-01-01 |
| 1536 | 1 2020-02-01 |
| 1537 | dtype: object |
| 1538 | |
| 1539 | For DatetimeIndex: |
| 1540 | |
| 1541 | >>> idx = pd.DatetimeIndex( |
| 1542 | ... ["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"] |
| 1543 | ... ) |
| 1544 | >>> idx.date |
| 1545 | array([datetime.date(2020, 1, 1), datetime.date(2020, 2, 1)], dtype=object) |
| 1546 | """ |
| 1547 | # If the Timestamps have a timezone that is not UTC, |
| 1548 | # convert them into their i8 representation while |
| 1549 | # keeping their timezone and not using UTC |
| 1550 | timestamps = self._local_timestamps() |
| 1551 | |
| 1552 | return ints_to_pydatetime(timestamps, box="date", reso=self._creso) |
| 1553 | |
| 1554 | def isocalendar(self) -> DataFrame: |
| 1555 | """ |