Could someone explain the meaning of [:,1] and explain the last line of code please

Screen Link: Learn data science with Python and R projects

My Code:

testing_probs = pd.DataFrame(columns=unique_origins)  

for origin in unique_origins:
    # Select testing features.
    X_test = test[features]   
    # Compute probability of observation being in the origin.
    testing_probs[origin] = models[origin].predict_proba(X_test)[:,1]

I am confused what the [:,1] part of this code does as I understood we need to apply prediction to find the classification between 3 origins. However wouldn’t index [:,1] call the first column and only apply to origin 1? Why am i unable to replace the code with [:,2] for example if the are 3 origins.

I am also confused why we are putting [:,1] at the end of the line in such a way.

Please explain as i am super confused with this and struggling to find answer

[:, 1] is being applied to what models[origin].predict_proba(X_test) returns and not to models[origin] before using predict_proba() on it.

We are indexing whatever predict_proba() outputs.

I would also recommend checking the documentation for predict_proba() to understand what it outputs and why we are indexing it.