In Python, why subsetting with or without square bracket is different? Suppose I have a data frame called quoteDF

quotesDF

              volume  shares
2017-01-03   2934300     100
2017-01-04   3381400     120
2017-01-05   2682300     140  
2017-01-06   2945500     160
2017-01-09   3189900     180
2017-01-10   4118700     200


If I do,

&gt; quotesDF.loc[1, 'shares']
120
&gt; quotesDF.loc[1, ['shares']]
shares 120
Name: 1, dtype: object


Why the first one retunrs 120, the second one retures shares 120? In my mind, they are the same thing, except I put the second one in a vector. But, the first one is a vector stands by itself. It's just that I didn't put the square bracket on it.

Why Python give me such a confusing time?
Assuming, you have a pandas dataframe, .loc is strictly label based. Since you're using [] it accesses the column you're specifying inside the brackets and that is the reason you're getting shares 120. Read documentation for better explanation. 

Here is another link that has answers similar to your question.