Skip to main content

is_pd_object

is_pd_object(
    obj,
    to_frame: bool = False,
)
Check if an object is a pd.DataFrame or pd.Series. Parameters:
NameTypeDefaultDescription
objobject--The object to check.
to_frameboolFalseIf True and the object is a pd.Series, convert it to a pd.DataFrame.
Raises:
TypeDescription
ValueErrorIf the object is neither a pd.DataFrame nor a pd.Series.
Returns:
TypeDescription
pd.DataFrame or NoneThe pd.DataFrame or pd.Series.

is_pd_dataframe

is_pd_dataframe(
    obj,
)
Check if an object is a pd.DataFrame. Parameters:
NameTypeDefaultDescription
objobject--The object to check.
Raises:
TypeDescription
ValueErrorIf the object is not a pd.DataFrame.

is_valid_shape

is_valid_shape(
    a: pandas.core.frame.DataFrame,
    b: pandas.core.frame.DataFrame,
) ‑> pandas.core.frame.DataFrame
Validate the shape of two objects and align them if necessary. Parameters:
NameTypeDefaultDescription
apd.DataFrame--The first DataFrame.
bpd.DataFrame--The second DataFrame.
Raises:
TypeDescription
ValueErrorIf the shapes are not compatible.
Returns:
TypeDescription
pd.DataFrameThe aligned second pd.DataFrame.

is_valid_squarred_shape

is_valid_squarred_shape(
    cov: pandas.core.frame.DataFrame,
    weights: pandas.core.series.Series | pandas.core.frame.DataFrame,
)
Check if a covariance matrix is square and aligned with weights. Parameters:
NameTypeDefaultDescription
covpd.DataFrame--The covariance matrix.
weightstp.SeriesFrame--The weights vector.
Raises:
TypeDescription
ValueErrorIf the covariance matrix is not square or not aligned with weights.

is_fitted

is_fitted(
    attr_name: str,
    raise_error: bool = True,
    custom_func: Type = None,
    **custom_func_kwargs,
) ‑> Callable
Decorator to check if an object is fitted. Parameters:
NameTypeDefaultDescription
attr_namestr--The name of the attribute to check.
raise_errorboolTrueIf True, raise an error if the object is not fitted.
custom_funccallableNoneA custom function to call if the object is not fitted.
custom_func_kwargstp.Kwargs--Additional arguments for the custom function.
Raises:
TypeDescription
NotFittedErrorIf the object is not fitted and raise_error is True.
Returns:
TypeDescription
tp.CallableThe decorated method.

is_freq_valid

is_freq_valid(
    index: pandas.core.indexes.base.Index,
    freq: str,
)
Check if the frequency of a pd.Index is valid. Parameters:
NameTypeDefaultDescription
indexpd.Index--The index to check.
freqstr--The target frequency.
Raises:
TypeDescription
ValueErrorIf the frequency cannot be parsed.
Returns:
TypeDescription
boolTrue if the frequency is valid, False otherwise.

is_int

is_int(
    arg: Any,
) ‑> bool
Check if an argument is an int (excluding timedelta). Parameters:
NameTypeDefaultDescription
argtp.Any--The argument to check.
Returns:
TypeDescription
boolTrue if the argument is an integer, False otherwise.

is_float

is_float(
    arg: Any,
) ‑> bool
Check if an argument is a float. Parameters:
NameTypeDefaultDescription
argtp.Any--The argument to check.
Returns:
TypeDescription
boolTrue if the argument is a float, False otherwise.

is_number

is_number(
    arg: Any,
) ‑> bool
Check if an argument is a number. Parameters:
NameTypeDefaultDescription
argtp.Any--The argument to check.
Returns:
TypeDescription
boolTrue if the argument is a number, False otherwise.