Python and pandas: is df["colName"] exactly equivalent to df.loc[:,"colName"]?
Yes, they do the same thing.
df['colName'] will return the column specified in the square brackets, and df.loc['rowName'] will return the row specified in the square brackets.
df.loc['row1Name':'row2Name','colName'] will return all the elements of the column
specified in the brackets, from the first row specified to the last row specified.
df.loc[:,'colName'] is basically telling python to return all the elements from the column specied
from all the rows, and so, it returns the whole column.
Note that the parsing process may differ, one way may be more efficient than the other.
I've tested a lot of scenarios and in every one of them, df['colName'] has outputted the same thing as df.loc[:,'colName'].
I'm just wanting to be sure that these really are exactly equivalent.