There are 2 ways to index the columns of a dataframe
Such indexing may appear on the Right hand side of an assignment, meaning you want to process it/assign the indexed data to something else, or can appear on the Left hand side, meaning you want to assign to it.
If it appears on the left, 2. can only work if that column already exist in the dataframe. 1 will work no matter that column is new or overwriting an existing one.
Read “Attribute Access” section on the link you provided for more information. The example there isn’t very good, so best to create your own dataframe and prove it with your own eyes.
I prefer 1. always because it handles column names with spaces, also IDE will color code the string and make it more readable to what columns are being used in a processing pipeline.
Thank you very much for your explanation. However, I didn’t see the reason why I got the warning from this line of code. Do you have any idea about this? Or will it be helpful if I attach the data frame recent_grads? It is from one guided project.