Search code examples
python-3.xazureml-studio

Execute Python Script Module Failing in Azure ML Studio


I'm using Execute Python Script module in Azure ML Studio and have written the most basic of code:

import pandas as pd
def azureml_main(dataframe1 = None, dataframe2 = None):
    dataframe1["Result"] = dataframe1["3MPurchNo"] * 3
    return dataframe1,

It fails with the following error:

File "C:\server\XDRReader\xdrwriter3.py", 
line 190, 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 [<class 'numpy.int32'>]
Process returned with non-zero exit code 1

Solution

  • This seems to be a bug/feature whereby a dataframe with an int column will not be successfully returned to ML Studio. You can fix it by casting columns to float type.

    import pandas as pd
    def azureml_main(dataframe1 = None, dataframe2 = None):
        dataframe1["Result"] = (dataframe1["3MPurchNo"] * 3).astype(float)
        return dataframe1,
    

    Hope this helps others