How to send custom data to scenario report?

Sunny
Sunny Registered Posts: 6

Hi,

I would like to return some values from the dataset that was build as a part of the scenario in the report.

Tagged:

Answers

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,225 Dataiker
    edited July 17

    Hi @Sunny
    ,
    You could use a python step to set scenario variable and later use these in the reporter.

    Here is an example where I add the df.shape as a variable

    # -*- coding: utf-8 -*-
    import dataiku
    import pandas as pd
    from dataiku import pandasutils as pdu
    from dataiku.scenario import Scenario
    
    # Read recipe inputs
    crm_history = dataiku.Dataset("crm_history")
    df = crm_history.get_dataframe()
    
    variable_value = str(df.shape)
    
    scenario = Scenario()
    
    variable_param = {"df_shape_var": variable_value}
    scenario.set_scenario_variables(**variable_param)
    
    # Print all variables now available for troubleshooting
    variables = Scenario().get_all_variables()
    print(variables)
Setup Info
    Tags
      Help me…