Skip to main content



Asserts that only the given valid values present in the given column. This assertion can be used with Layer dataset entities.

  • Parameters

    • column_name (str) -- Column name to be checked from the given dataframe.
    • valid_values (List[Any**]) -- Valid values.
  • Returns

    Function object.

  • Return type

    Callable[[...], Any]

from layer.decorators.assertions import assert_valid_values
from layer.decorators import dataset

@assert_valid_values("OperatingSystem", ["linux", "other"])
def create_my_dataset():
data = [["user1", "linux"], ["user2", "linux"], ["user3", "other"]]
dataframe = pd.DataFrame(data, columns=["UserName", "OperatingSystem"])
return dataframe