Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hello Dataiku community,
I've created a custom metric which returns len(example_variable) and I am using this metric as the value I want to check, however I am getting the below warning.
Message: Cannot check: ARRAY is not numeric
I am not sure why I'm getting this message as the metric is an INT.
What am I doing wrong?
Try with this metric probe, it should be added on the dataset you want it to run:
def process(dataset):
df = dataset.get_dataframe()
empty_columns = []
for col in df:
if len(df[col].value_counts()) == 0:
empty_columns.append(col)
return {'metric_name' : len(empty_columns)}
Please post the code of your Python probe.
# Define here a function that returns the metric.
import dataiku
def process():
example_dataset = dataiku.Dataset("example_dataset")
df = example_dataset.get_dataframe()
empty_columns = []
for col in df:
if len(df[col].value_counts()) == 0:
empty_columns.append(col)
return len(empty_columns)
Try with this metric probe, it should be added on the dataset you want it to run:
def process(dataset):
df = dataset.get_dataframe()
empty_columns = []
for col in df:
if len(df[col].value_counts()) == 0:
empty_columns.append(col)
return {'metric_name' : len(empty_columns)}
Unfortunately, did not work. I am still getting the same error on the check side.
I was able to get the check working with @Turribeach 's probe. I can recreate your error by returning the list instead of the len(list).
Can you double check that you have the right metric selected in the check? Since the fix returns a dict it might have created a new metric.
Oh, yes you're right, it works now, thank you!
Final tip: donโt forget to add your scenario step to calculate metrics and checks or alternatively you can set them to compute at build time.