Detail: IndexYear: Constructor

Overview: IndexYear: Constructor

IndexYear.__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.IndexYear(('1517', '1520', '1518'))
<IndexYear>
1517
1520
1518
<datetime64[Y]>
classmethod IndexYear.from_date_range(start, stop, step=1, *, name=None)[source]

Get an IndexYearMonth instance over a range of dates, where start and stop are inclusive.

>>> sf.IndexYear.from_date_range('2021-12-30', '2022-01-02')
<IndexYear>
2021
2022
<datetime64[Y]>
classmethod IndexYear.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.IndexYear.from_labels(('1517', '1520', '1518'))
<IndexYear>
1517
1520
1518
<datetime64[Y]>
classmethod IndexYear.from_pandas(value)

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

>>> ix = pd.Index(('1517', '1520', '1518'))
>>> sf.IndexYear.from_pandas(ix)
<Index>
1517
1520
1518
<object>
classmethod IndexYear.from_year_month_range(start, stop, step=1, *, name=None)[source]

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

>>> sf.IndexYear.from_year_month_range('2021-12', '2022-01')
<IndexYear>
2021
2022
<datetime64[Y]>
classmethod IndexYear.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.IndexYear.from_year_range('2021', '2022')
<IndexYear>
2021
2022
<datetime64[Y]>

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