Detail: SeriesHE: Accessor Type Clinic

Overview: SeriesHE: Accessor Type Clinic

SeriesHE.via_type_clinic.to_hint
SeriesHE.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.

>>> s = sf.SeriesHE((False, True, True), index=('p', 'q', 'r'))
>>> s
<SeriesHE>
<Index>
p          False
q          True
r          True
<<U1>      <bool>
>>> s.via_type_clinic.to_hint()
static_frame.core.series.SeriesHE[static_frame.core.index.Index[numpy.str_], numpy.bool_]
SeriesHE.via_type_clinic.check(hint, *, fail_fast)
SeriesHE.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.

>>> s = sf.SeriesHE((False, True, True), index=('p', 'q', 'r'))
>>> s
<SeriesHE>
<Index>
p          False
q          True
r          True
<<U1>      <bool>
>>> s.via_type_clinic.check(sf.Series[sf.Index[np.str_], np.int64])
ClinicError('\nIn Series[Index[str_], int64]\n└── Expected int64, provided bool_ invalid')
SeriesHE.via_type_clinic.warn(hint, *, fail_fast, category)
SeriesHE.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.

SeriesHE.via_type_clinic.__call__(hint, *, fail_fast)
SeriesHE.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.

>>> s = sf.SeriesHE((False, True, True), index=('p', 'q', 'r'))
>>> s
<SeriesHE>
<Index>
p          False
q          True
r          True
<<U1>      <bool>
>>> cr = s.via_type_clinic(sf.Series[sf.Index[np.str_], np.int64])
>>> cr
<ClinicResult: 1 error>
>>> cr.validated
False
>>> cr.to_str()

In Series[Index[str_], int64]
└── Expected int64, provided bool_ invalid
SeriesHE.via_type_clinic.__repr__
SeriesHE.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.

>>> s = sf.SeriesHE((False, True, True), index=('p', 'q', 'r'))
>>> s
<SeriesHE>
<Index>
p          False
q          True
r          True
<<U1>      <bool>
>>> s.via_type_clinic
SeriesHE[Index[str_], bool_]

SeriesHE: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Assignment | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Fill Value | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic