Hi,
You need to fix the Python code in the exercise below. The job will not run correctly and results in a syntax error.
AI-900:
https://learn.microsoft.com/en-us/training/modules/create-regression-model-azure-machine-learning-designer/6-exercise
Exercise:
https://microsoftlearning.github.io/AI-900-AIFundamentals/instructions/02a-create-regression-model.html
Error in step "Create and run an inference pipeline".
---------- Start of error message from Python interpreter ----------
| Got exception when invoking script: 'SyntaxError: 'return' outside function (user_script_7f52874cc1094c7a8e8534ef337933f3.py, line 8)'.
| ---------- End of error message from Python interpreter ----------")
Code from exercise: (With errors)
import pandas as pd
def azureml_main(dataframe1 = None, dataframe2 = None):
scored_results = dataframe1[['Scored Labels']]
scored_results.rename(columns={'Scored Labels':'predicted_price'},
inplace=True)
return scored_results
Correct code: