I have an example data frame as
age education income
21 Bachelors 40k
42 Masters 50k
51 PhD 55k
X_test = df[['age, 'education']] Y_test = df[['income']]
I have a loop below which is supposed to post the predictors:
for i in range(2):
input_data = dict(X_test.iloc[i])
y = Y_test.iloc[i]
r = requests.post("MY_POST_ENDPOINT", input_data)
response = r.json()
requests.put("MY_POST_ENDPOINT/{}").format(response['request_id']),{'feedback':y}
I get that only the first row in the loop returns a success response status, and the others fail, but when I post each row individually, it works. I would like to know if anyone has a solution to why the loop is falling somewhere?