Skip to main content

assert_not_null

assert_not_null()

Asserts that given columns do not have any null values. This assertion can be used with Layer dataset entities.

  • Parameters

    column_names (List[str**]) -- List of columns to be checked.

  • Returns

    Function object.

  • Return type

    Callable[[...], Any]

from layer.decorators.assertions import assert_not_null
from layer.decorators import dataset

@dataset("user-os-data")
@assert_not_null(["UserName", "OperatingSystem"])
def create_my_dataset():
# No null value in the dataframe. Prints a success message.
data = [["user1", "linux"], ["user2", "linux"], ["user3", "other"]]
dataframe = pd.DataFrame(data, columns=["UserName", "OperatingSystem"])
return dataframe