|
| 1 | +# Contains code from https://github.com/pandas-dev/pandas/blob/main/pandas/core/indexes/datetimes.py |
| 2 | + |
| 3 | +from __future__ import annotations |
| 4 | + |
| 5 | +from bigframes_vendored import constants |
| 6 | +from bigframes_vendored.pandas.core.indexes import base |
| 7 | + |
| 8 | + |
| 9 | +class DatetimeIndex(base.Index): |
| 10 | + """Immutable sequence used for indexing and alignment with datetime-like values""" |
| 11 | + |
| 12 | + @property |
| 13 | + def year(self) -> base.Index: |
| 14 | + """The year of the datetime |
| 15 | +
|
| 16 | + **Examples:** |
| 17 | +
|
| 18 | + >>> import bigframes.pandas as bpd |
| 19 | + >>> import pandas as pd |
| 20 | + >>> bpd.options.display.progress_bar = None |
| 21 | +
|
| 22 | + >>> idx = bpd.Index([pd.Timestamp("20250215")]) |
| 23 | + >>> idx.year |
| 24 | + Index([2025], dtype='Int64') |
| 25 | + """ |
| 26 | + raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) |
| 27 | + |
| 28 | + @property |
| 29 | + def month(self) -> base.Index: |
| 30 | + """The month as January=1, December=12. |
| 31 | +
|
| 32 | + **Examples:** |
| 33 | +
|
| 34 | + >>> import bigframes.pandas as bpd |
| 35 | + >>> import pandas as pd |
| 36 | + >>> bpd.options.display.progress_bar = None |
| 37 | +
|
| 38 | + >>> idx = bpd.Index([pd.Timestamp("20250215")]) |
| 39 | + >>> idx.month |
| 40 | + Index([2], dtype='Int64') |
| 41 | + """ |
| 42 | + raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) |
| 43 | + |
| 44 | + @property |
| 45 | + def day(self) -> base.Index: |
| 46 | + """The day of the datetime. |
| 47 | +
|
| 48 | + **Examples:** |
| 49 | +
|
| 50 | + >>> import bigframes.pandas as bpd |
| 51 | + >>> import pandas as pd |
| 52 | + >>> bpd.options.display.progress_bar = None |
| 53 | +
|
| 54 | + >>> idx = bpd.Index([pd.Timestamp("20250215")]) |
| 55 | + >>> idx.day |
| 56 | + Index([15], dtype='Int64') |
| 57 | + """ |
| 58 | + raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) |
| 59 | + |
| 60 | + @property |
| 61 | + def day_of_week(self) -> base.Index: |
| 62 | + """The day of the week with Monday=0, Sunday=6. |
| 63 | +
|
| 64 | + **Examples:** |
| 65 | +
|
| 66 | + >>> import bigframes.pandas as bpd |
| 67 | + >>> import pandas as pd |
| 68 | + >>> bpd.options.display.progress_bar = None |
| 69 | +
|
| 70 | + >>> idx = bpd.Index([pd.Timestamp("20250215")]) |
| 71 | + >>> idx.day_of_week |
| 72 | + Index([5], dtype='Int64') |
| 73 | + """ |
| 74 | + raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) |
| 75 | + |
| 76 | + @property |
| 77 | + def dayofweek(self) -> base.Index: |
| 78 | + """The day of the week with Monday=0, Sunday=6. |
| 79 | +
|
| 80 | + **Examples:** |
| 81 | +
|
| 82 | + >>> import bigframes.pandas as bpd |
| 83 | + >>> import pandas as pd |
| 84 | + >>> bpd.options.display.progress_bar = None |
| 85 | +
|
| 86 | + >>> idx = bpd.Index([pd.Timestamp("20250215")]) |
| 87 | + >>> idx.dayofweek |
| 88 | + Index([5], dtype='Int64') |
| 89 | + """ |
| 90 | + raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) |
| 91 | + |
| 92 | + @property |
| 93 | + def weekday(self) -> base.Index: |
| 94 | + """The day of the week with Monday=0, Sunday=6. |
| 95 | +
|
| 96 | + **Examples:** |
| 97 | +
|
| 98 | + >>> import bigframes.pandas as bpd |
| 99 | + >>> import pandas as pd |
| 100 | + >>> bpd.options.display.progress_bar = None |
| 101 | +
|
| 102 | + >>> idx = bpd.Index([pd.Timestamp("20250215")]) |
| 103 | + >>> idx.weekday |
| 104 | + Index([5], dtype='Int64') |
| 105 | + """ |
| 106 | + raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) |
0 commit comments