Detail: IndexDate: Constructor

Overview: IndexDate: Constructor

IndexDate.__init__(labels, *, name=<object object>, loc_is_iloc=False)

Initializer.

Parameters
  • labels – Iterable of hashable values to be used as the index labels. If strings, NumPy datetime conversions will be applied.

  • name – A hashable object to label the container.

>>> sf.IndexDate(('1517-04-01', '1517-12', '1517-06-30'))
<IndexDate>
1517-04-01
1517-12-01
1517-06-30
<datetime64[D]>
classmethod IndexDate.from_date_range(start, stop, step=1, *, name=None)[source]

Get an IndexDate instance over a range of dates, where start and stop is inclusive.

>>> sf.IndexDate.from_date_range('2021-12-30', '2022-01-02')
<IndexDate>
2021-12-30
2021-12-31
2022-01-01
2022-01-02
<datetime64[D]>
classmethod IndexDate.from_labels(labels, *, name=None)

Construct an Index from an iterable of labels, where each label is a hashable. Provided for a compatible interface to IndexHierarchy.

>>> sf.IndexDate.from_labels(('1517-04-01', '1517-12', '1517-06-30'))
<IndexDate>
1517-04-01
1517-12-01
1517-06-30
<datetime64[D]>
classmethod IndexDate.from_pandas(value)

Given a Pandas index, return the appropriate IndexBase derived class.

>>> ix = pd.Index(('1517-04-01', '1517-12', '1517-06-30'))
>>> sf.IndexDate.from_pandas(ix)
<Index>
1517-04-01
1517-12
1517-06-30
<object>
classmethod IndexDate.from_year_month_range(start, stop, step=1, *, name=None)[source]

Get an IndexDate instance over a range of months, where start and end are inclusive.

>>> sf.IndexDate.from_year_month_range('2021-12', '2022-01')
<IndexDate>
2021-12-01
2021-12-02
2021-12-03
2021-12-04
2021-12-05
2021-12-06
2021-12-07
2021-12-08
2021-12-09
2021-12-10
2021-12-11
2021-12-12
2021-12-13
2021-12-14
2021-12-15
2021-12-16
2021-12-17
...
2022-01-15
2022-01-16
2022-01-17
2022-01-18
2022-01-19
2022-01-20
2022-01-21
2022-01-22
2022-01-23
2022-01-24
2022-01-25
2022-01-26
2022-01-27
2022-01-28
2022-01-29
2022-01-30
2022-01-31
<datetime64[D]>
classmethod IndexDate.from_year_range(start, stop, step=1, *, name=None)[source]

Get an IndexDate instance over a range of years, where start and end are inclusive.

>>> sf.IndexDate.from_year_range('2021', '2022')
<IndexDate>
2021-01-01
2021-01-02
2021-01-03
2021-01-04
2021-01-05
2021-01-06
2021-01-07
2021-01-08
2021-01-09
2021-01-10
2021-01-11
2021-01-12
2021-01-13
2021-01-14
2021-01-15
2021-01-16
2021-01-17
...
2022-12-15
2022-12-16
2022-12-17
2022-12-18
2022-12-19
2022-12-20
2022-12-21
2022-12-22
2022-12-23
2022-12-24
2022-12-25
2022-12-26
2022-12-27
2022-12-28
2022-12-29
2022-12-30
2022-12-31
<datetime64[D]>

IndexDate: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Regular Expression | Accessor Hashlib