Runs a model on a pandas DataFrame and returns the predictions.

Input ParameterTypeDefaultDescription
project_idstrNoneThe unique identifier for the project.
model_idstrNoneA unique identifier for the model.
dfpd.DataFrameNoneA pandas DataFrame containing model input vectors as rows.
log_eventsOptional [bool]FalseIf True, the rows of df along with the model predictions will be logged as production events.
casting_typeOptional [bool]FalseIf True, will try to cast the data in the events to be in line with the data types defined in the model's ModelInfo object.
import pandas as pd

PROJECT_ID = 'example_project'
MODEL_ID = 'example_model'

df = pd.read_csv('example_data.csv')

predictions = client.run_model(
Return TypeDescription
pd.DataFrameA pandas DataFrame containing model predictions for the given input vectors.