Detail: Series: Accessor Type Clinic
Overview: Series: Accessor Type Clinic
- Series.via_type_clinic.to_hint
- Series.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.Series((False, True, True), index=('p', 'q', 'r')) >>> s <Series> <Index> p False q True r True <<U1> <bool> >>> s.via_type_clinic.to_hint() static_frame.core.series.Series[static_frame.core.index.Index[numpy.str_], numpy.bool_]
- Series.via_type_clinic.check(hint, *, fail_fast)
- Series.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.Series((False, True, True), index=('p', 'q', 'r')) >>> s <Series> <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')
- Series.via_type_clinic.warn(hint, *, fail_fast, category)
- Series.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.
- Series.via_type_clinic.__call__(hint, *, fail_fast)
- Series.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.Series((False, True, True), index=('p', 'q', 'r')) >>> s <Series> <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
- Series.via_type_clinic.__repr__
- Series.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.Series((False, True, True), index=('p', 'q', 'r')) >>> s <Series> <Index> p False q True r True <<U1> <bool> >>> s.via_type_clinic Series[Index[str_], bool_]
Series: 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