Confusion between doing .copy() and using [[ ]] I am reading &quot;Hands-On Machine Learning with Scikit-Learn and Tensorflow&quot; by Aurélien Géron.
Sometimes he does
xyz = DataFrame[[&quot;col1&quot;]]

Which returns a dataframe, but other times:
xyz = DataFrame[&quot;col1&quot;].copy()

Which reuturns a series
I do understand that both are ways of copying and not using a 'view', but when should we use each?
(ps: I only found information about views refering to arrayas in numpy... Are the arrays in numpy the same DataFrames in Pandas?)
Both are more or less the same thing.
xyz = DataFrame[[&quot;col1&quot;]] is useful when you have to select one or more than one column from a dataframe. For example: xyz = DataFrame[[&quot;col1&quot;,&quot;col2&quot;]]
While xyz = DataFrame[&quot;col1&quot;].copy() or df.copy() is used for copying a complete/partial dataframe.
Note that both are exactly the same.