Complete the code to generate a statistics summary from a dataset using TFDV.
import tensorflow_data_validation as tfdv stats = tfdv.generate_statistics_from_dataframe([1]) print(stats)
The function generate_statistics_from_dataframe requires a pandas DataFrame as input. Here, df is the variable holding the dataset.
Complete the code to infer a schema from the statistics using TFDV.
schema = tfdv.infer_schema(statistics=[1]) print(schema)
The infer_schema function takes the statistics object as input to create a schema.
Fix the error in the code to validate the dataset against the schema using TFDV.
anomalies = tfdv.validate_statistics(statistics=[1], schema=schema) print(anomalies)
The validate_statistics function requires the statistics object as the first argument to check for anomalies against the schema.
Fill both blanks to generate statistics and infer schema from a CSV file using TFDV.
import tensorflow_data_validation as tfdv stats = tfdv.generate_statistics_from_csv(data_location=[1]) schema = tfdv.infer_schema(statistics=[2]) print(schema)
Use the CSV file path as a string for data_location. Then pass the statistics variable stats to infer the schema.
Fill all three blanks to generate statistics, infer schema, and validate statistics from a pandas DataFrame using TFDV.
import tensorflow_data_validation as tfdv stats = tfdv.generate_statistics_from_dataframe([1]) schema = tfdv.infer_schema(statistics=[2]) anomalies = tfdv.validate_statistics(statistics=[3], schema=schema) print(anomalies)
First, pass the DataFrame df to generate statistics. Then use stats to infer the schema and validate statistics.
