Detail: IndexYearMonth: Accessor Type Clinic

Overview: IndexYearMonth: Accessor Type Clinic

IndexYearMonth.via_type_clinic.to_hint
IndexYearMonth.via_type_clinic
TypeClinic.to_hint()[source]

Return the type hint (the type and/or generic aliases necessary) to represent the object given at initialization.

>>> ix = sf.IndexYearMonth(('1517-04', '1517-12', '1517-06'))
>>> ix
<IndexYearMonth>
1517-04
1517-12
1517-06
<datetime64[M]>
>>> ix.via_type_clinic.to_hint()
<class 'static_frame.core.index_datetime.IndexYearMonth'>
IndexYearMonth.via_type_clinic.check(hint, *, fail_fast)
IndexYearMonth.via_type_clinic
TypeClinic.check(hint, /, *, fail_fast=False)[source]

Given a hint (a type and/or generic alias), raise a ClinicError exception describing the result of the check if an error is found.

Parameters:

fail_fast – If True, return on first failure. If False, all failures are discovered and reported.

>>> ix = sf.IndexYearMonth(('1517-04', '1517-12', '1517-06'))
>>> ix
<IndexYearMonth>
1517-04
1517-12
1517-06
<datetime64[M]>
>>> ix.via_type_clinic.check(sf.Index[np.str_])
ClinicError('\nIn Index[str_]\n└── Expected str_, provided datetime64 invalid')
IndexYearMonth.via_type_clinic.warn(hint, *, fail_fast, category)
IndexYearMonth.via_type_clinic
TypeClinic.warn(hint, /, *, fail_fast=False, category=<class 'UserWarning'>)[source]

Given a hint (a type and/or generic alias), issue a warning describing the result of the check if an error is found.

Parameters:
  • fail_fast – If True, return on first failure. If False, all failures are discovered and reported.

  • category – The Warning subclass to be used for issueing the warning.

IndexYearMonth.via_type_clinic.__call__(hint, *, fail_fast)
IndexYearMonth.via_type_clinic
TypeClinic.__call__(hint, /, *, fail_fast=False)[source]

Given a hint (a type and/or generic alias), return a ClinicResult object describing the result of the check.

Parameters:

fail_fast – If True, return on first failure. If False, all failures are discovered and reported.

>>> ix = sf.IndexYearMonth(('1517-04', '1517-12', '1517-06'))
>>> ix
<IndexYearMonth>
1517-04
1517-12
1517-06
<datetime64[M]>
>>> cr = ix.via_type_clinic(sf.Index[np.str_])
>>> cr
<ClinicResult: 1 error>
>>> cr.validated
False
>>> cr.to_str()

In Index[str_]
└── Expected str_, provided datetime64 invalid
IndexYearMonth.via_type_clinic.__repr__
IndexYearMonth.via_type_clinic
TypeClinic.__repr__()[source]

Return a compact string representation of the type hint (the type and/or generic aliases necessary) to represent the object given at initialization.

>>> ix = sf.IndexYearMonth(('1517-04', '1517-12', '1517-06'))
>>> ix
<IndexYearMonth>
1517-04
1517-12
1517-06
<datetime64[M]>
>>> ix.via_type_clinic
IndexYearMonth

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