Detail: IndexDate: Accessor Type Clinic

Overview: IndexDate: Accessor Type Clinic

IndexDate.via_type_clinic.to_hint
IndexDate.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.IndexDate(('1517-04-01', '1517-12', '1517-06-30'))
>>> ix
<IndexDate>
1517-04-01
1517-12-01
1517-06-30
<datetime64[D]>
>>> ix.via_type_clinic.to_hint()
<class 'static_frame.core.index_datetime.IndexDate'>
IndexDate.via_type_clinic.check(hint, *, fail_fast)
IndexDate.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.IndexDate(('1517-04-01', '1517-12', '1517-06-30'))
>>> ix
<IndexDate>
1517-04-01
1517-12-01
1517-06-30
<datetime64[D]>
>>> ix.via_type_clinic.check(sf.Index[np.str_])
ClinicError('\nIn Index[str_]\n└── Expected str_, provided datetime64 invalid')
IndexDate.via_type_clinic.warn(hint, *, fail_fast, category)
IndexDate.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.

IndexDate.via_type_clinic.__call__(hint, *, fail_fast)
IndexDate.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.IndexDate(('1517-04-01', '1517-12', '1517-06-30'))
>>> ix
<IndexDate>
1517-04-01
1517-12-01
1517-06-30
<datetime64[D]>
>>> 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
IndexDate.via_type_clinic.__repr__
IndexDate.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.IndexDate(('1517-04-01', '1517-12', '1517-06-30'))
>>> ix
<IndexDate>
1517-04-01
1517-12-01
1517-06-30
<datetime64[D]>
>>> ix.via_type_clinic
IndexDate

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 | Accessor Type Clinic