General specifications

NaN handling

Most functions take a parameter nan_policy to specify how to handle nan values in the data. The options are:

  • warn (default) – Warn on nan values

  • raise – Raise an error on nan values

  • omit – Silently drop rows with nan values

yli.utils.check_nan(df, nan_policy, *, cols=None)

Check df against nan_policy and return cleaned input

Parameters:
  • df (DataFrame) – Data to check for NaNs

  • nan_policy (str) – Policy to apply when encountering NaN values (warn, raise, omit)

  • cols (List[str]) – Columns to check for NaN, or None for all columns

Returns:

Data with NaNs removed, which may or may not be copied

Return type:

DataFrame

dtype conventions

yli.as_ordinal(data)

Convert the data to an ordered category dtype

Parameters:

data – Data to convert

Return type:

Series

General result classes

class yli.utils.Estimate(point, ci_lower, ci_upper)

A point estimate and surrounding confidence interval

ci_lower

Lower confidence limit (float)

ci_upper

Upper confidence limit (float)

point

Point estimate (float)

summary()

Return a stringified summary of the estimate and confidence interval

Return type:

str

class yli.utils.Interval(lower, upper)

An interval (e.g. confidence interval)

lower

Lower limit (float)

summary()

Return a stringified summary of the interval

Return type:

str

upper

Upper limit (float)