Check is working and returned WARNING, Message: Cannot check: ARRAY is not numeric

Solved!
KKhatib
Level 2
Check is working and returned WARNING, Message: Cannot check: ARRAY is not numeric

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? 

0 Kudos
1 Solution

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)}

 

View solution in original post

7 Replies
Turribeach

Please post the code of your Python probe. 

0 Kudos
KKhatib
Level 2
Author

 

# 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)

 

0 Kudos

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)}

 

KKhatib
Level 2
Author

Unfortunately, did not work. I am still getting the same error on the check side. 

0 Kudos

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.

KKhatib
Level 2
Author

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.