Skip to main content

assert_skewness

assert_skewness()

Asserts that skewness value of the given column is in between the given minimum and maximum values. This assertion can be used with Layer dataset entities.

  • Parameters

    • column_name (str) -- Column to be checked.
    • min_skewness (float) -- Accepted minimum skewness value.
    • max_skewness (float) -- Accepted maximum skewness value.
  • Returns

    Function object.

  • Return type

    Callable[[...], Any]

from layer.decorators.assertions import assert_skewness
from layer.decorators import dataset

@dataset("product-data")
@assert_skewness("Price", -0.3, 0.3)
def create_my_dataset():
# Assert success as skewness is lower than the threshold.
data = [[1, "product1", 15], [2, "product2", 20], [3, "product3", 10]]
dataframe = pd.DataFrame(data, columns=["Id", "Product", "Price"])
return dataframe