Detail: IndexYearMonth: Constructor#
Overview: IndexYearMonth: Constructor
- IndexYearMonth.__init__(labels, /, *, loc_is_iloc=False, name=<object object>, sort_status=SortStatus.UNKNOWN)#
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.IndexYearMonth(('1517-04', '1517-12', '1517-06')) <IndexYearMonth> 1517-04 1517-12 1517-06 <datetime64[M]>
- classmethod IndexYearMonth.from_date_range(start, stop, step=1, *, name=None)[source]#
Get an IndexYearMonth instance over a range of dates, where start and stop is inclusive.
>>> sf.IndexYearMonth.from_date_range('2021-12-30', '2022-01-02') <IndexYearMonth> 2021-12 2022-01 <datetime64[M]>
- classmethod IndexYearMonth.from_difference(*others)#
Construct a new Index based on the difference with Index, containers, or NumPy arrays. Retains order.
>>> ix1 = sf.IndexYearMonth.from_labels(('1517-04', '1517-12', '1517-06')) >>> ix1 <IndexYearMonth> 1517-04 1517-12 1517-06 <datetime64[M]> >>> ix2 = sf.IndexYearMonth.from_labels(('2022-04', '2021-12', '2018-06')) >>> ix2 <IndexYearMonth> 2022-04 2021-12 2018-06 <datetime64[M]> >>> sf.IndexYearMonth.from_difference(ix1, ix2) <IndexYearMonth> 1517-04 1517-12 1517-06 <datetime64[M]>
- classmethod IndexYearMonth.from_intersection(*others)#
Construct a new Index based on the intersection with Index, containers, or NumPy arrays. Identical comparisons retain order.
>>> ix1 = sf.IndexYearMonth.from_labels(('1517-04', '1517-12', '1517-06')) >>> ix1 <IndexYearMonth> 1517-04 1517-12 1517-06 <datetime64[M]> >>> ix2 = sf.IndexYearMonth.from_labels(('2022-04', '2021-12', '2018-06')) >>> ix2 <IndexYearMonth> 2022-04 2021-12 2018-06 <datetime64[M]> >>> sf.IndexYearMonth.from_intersection(ix1, ix2) <IndexYearMonth> <datetime64[M]>
- classmethod IndexYearMonth.from_labels(labels, /, *, name=None)#
Construct an
Indexfrom an iterable of labels, where each label is a hashable. Provided for a compatible interface toIndexHierarchy.>>> sf.IndexYearMonth.from_labels(('1517-04', '1517-12', '1517-06')) <IndexYearMonth> 1517-04 1517-12 1517-06 <datetime64[M]>
- classmethod IndexYearMonth.from_pandas(value, /)#
Given a Pandas index, return the appropriate IndexBase derived class.
>>> ix = pd.Index(('1517-04', '1517-12', '1517-06')) >>> sf.IndexYearMonth.from_pandas(ix) <Index> 1517-04 1517-12 1517-06 <object>
- classmethod IndexYearMonth.from_union(*others)#
Construct a new Index based on the union with Index, containers, or NumPy arrays. Identical comparisons retain order.
>>> ix1 = sf.IndexYearMonth.from_labels(('1517-04', '1517-12', '1517-06')) >>> ix1 <IndexYearMonth> 1517-04 1517-12 1517-06 <datetime64[M]> >>> ix2 = sf.IndexYearMonth.from_labels(('2022-04', '2021-12', '2018-06')) >>> ix2 <IndexYearMonth> 2022-04 2021-12 2018-06 <datetime64[M]> >>> sf.IndexYearMonth.from_union(ix1, ix2) <IndexYearMonth> 1517-04 1517-06 1517-12 2018-06 2021-12 2022-04 <datetime64[M]>
- classmethod IndexYearMonth.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.IndexYearMonth.from_year_month_range('2021-12', '2022-01') <IndexYearMonth> 2021-12 2022-01 <datetime64[M]>
- classmethod IndexYearMonth.from_year_range(start, stop, step=1, *, name=None)[source]#
Get an IndexYearMonth instance over a range of years, where start and end are inclusive.
>>> sf.IndexYearMonth.from_year_range('2021', '2022') <IndexYearMonth> 2021-01 2021-02 2021-03 2021-04 2021-05 2021-06 2021-07 2021-08 2021-09 2021-10 2021-11 2021-12 2022-01 2022-02 2022-03 2022-04 2022-05 2022-06 2022-07 2022-08 2022-09 2022-10 2022-11 2022-12 <datetime64[M]>
IndexYearMonth: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic