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 andto_frame()returns them as a dataframe.cleverly.IdentifiedEffect.available_methods()returns one.- Parameters:
- recordsiterable
ofMethodAvailability One record per method.
- question
strorNone, default=None The question in plain words, which the summary prints. Equality ignores it.
- recordsiterable
See also
cleverly.IdentifiedEffect.available_methodsWhat 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.
- detail{“short”, “full”},
- Returns:
SummaryA
strwhose 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”}
orNone, default=None Dataframe backend to return.
Noneuses pandas when installed, then the first available backend.
- backend{“pandas”, “polars”, “pyarrow”}
- Returns:
dataframeColumns
method,available,reason_codeandreason.