0 votes
1 view
in Azure by (5.8k points)

I have the below Python script. And I'm trying to return the new Dataframe created. Unfortunately, I'm getting "NotImplementedError:"

Please let me know, how to return a Dataframe in Azure ML from a python script


def azureml_main(df) :

    therm_patterns,therm_missed_patterns = thermostat_phase(df)

    th_pat = json.loads(therm_patterns)

    missed_th_pat = json.loads(therm_missed_patterns)

    light_patterns, light_missed_patterns = light_phase(df)

    lt_pat = json.loads(light_patterns)

    missed_lt_pat = json.loads(light_missed_patterns)

    for j in range (0,len(lt_pat)):

        for i in range (0,len(lt_pat[0]['John'])):


    for j in range (0,len(lt_pat)):

        for i in range (0,len(lt_pat[0]['Jane'])):


    for j in range (0,len(lt_pat)):

        for i in range (0,len(lt_pat[0]['Jen'])):


    for j in range (0,len(missed_lt_pat)):

        for i in range (0,len(missed_lt_pat[0]['John'])):


    for j in range (0,len(missed_lt_pat)):

        for i in range (0,len(missed_lt_pat[0]['Jane'])):


    for j in range (0,len(missed_lt_pat)):

        for i in range (0,len(missed_lt_pat[0]['Jen'])):


    output = json.dumps(th_pat)

    df = pd.DataFrame.from_dict({k: v[0] for k, v in json.loads(output) 

    [0].items()}, 'index' ).rename_axis('User').reset_index()

    return df         


  Error 0085: The following error occurred during script evaluation, please  

  view the output log for more information:

   ---------- Start of error message from Python interpreter ----------

   Caught exception while executing function: Traceback (most recent call  


       File "C:\server\invokepy.py", line 211, in batch

       xdrutils.XDRUtils.DataFrameToRFile(outlist[i], outfiles[i], True)

       File "C:\server\XDRReader\xdrutils.py", line 54, in DataFrameToRFile


       File "C:\server\XDRReader\xdrwriter2.py", line 155, in   



       File "C:\server\XDRReader\xdrwriter2.py", line 215, in write_object

       write_func(flags, converted, missingIndices)

       File "C:\server\XDRReader\xdrwriter2.py", line 185, in write_objects


       File "C:\server\XDRReader\xdrwriter2.py", line 200, in write_object

       raise NotImplementedError('Python Bridge conversion table not    

       implemented for type [{0}]'.format(value.getType()))

       NotImplementedError: Python Bridge conversion table not implemented  

       for type [<type 'list'>]

       Process returned with non-zero exit code 1

1 Answer

0 votes
by (9.6k points)

You can add Convert to CSV  to your Python script and  download it. That is the only way to do it now. Azure ML Studio does not return dataframes as of now. 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !