cleverly.MethodAvailabilities#

class cleverly.MethodAvailabilities(records: Iterable[MethodAvailability] = (), *, question: str | None = None)[source]#

The methods that can and cannot estimate one identified question.

A tuple of MethodAvailability, one per method name, so iteration, indexing and comparison with a tuple work as on any tuple; slicing and + give plain tuples. summary() prints them as a table and to_frame() returns them as a dataframe. cleverly.IdentifiedEffect.available_methods() returns one.

Parameters:
recordsiterable of MethodAvailability

One record per method.

questionstr or None, default=None

The question in plain words, which the summary prints. Equality ignores it.

See also

cleverly.IdentifiedEffect.available_methods

What returns this object.

Examples

>>> from cleverly import MethodAvailability
>>> from cleverly.methods import MethodAvailabilities
>>> methods = MethodAvailabilities([MethodAvailability("tmle", True)])
>>> [record.name for record in methods if record.available]
['tmle']
>>> methods.summary().facts["Methods that fit"]
'1 of 1'

Methods#

MethodAvailabilities.summary(*, detail: Literal['short', 'full'] = 'short') → Summary[source]#

Return the printed table of the methods.

Parameters:
detail{“short”, “full”}, default “short”

"full" adds why each method that does not fit does not.

Returns:
Summary

A str whose text is the printed table; a notebook renders it as HTML.

MethodAvailabilities.to_frame(backend: str | None = None) → Any[source]#

Return one row per method.

Parameters:
backend{“pandas”, “polars”, “pyarrow”} or None, default=None

Dataframe backend to return. None uses pandas when installed, then the first available backend.

Returns:
dataframe

Columns method, available, reason_code and reason.

Attributes#

MethodAvailabilities.question: str | None#