Does .loc[:, ['A','B']] assignment allow to change the dtype of the columns?
<p>I was baffled because I could not modify two columns at once using <code>.loc[:,['A', 'B']</code> which I guess is because it's returning a copy instead of a view. I cannot find in <a href="http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy" rel="nofollow noreferrer">Indexing and Selecting Data</a> a definitive guide on when it returns a view and when it returns a copy. </p>

<p>I'm using pandas 0.18 , I can see that in older version of the documentation (pandas 0.13) it used to say "Whenever an array of labels or a boolean vector are involved in the indexing operation, the result will be a copy" but I cannot find that in the current documentation </p>

<pre><code>pd.__version__
# u'0.18.0'
df = pd.DataFrame({'A': ['1', '2', '3', '4',
                         '5', '6', '7', '8'],
                   'B': ['1', '2', '3', '4',
                         '5', '6', '7', '8'],
                   'C': ['1', '2', '3', '4',
                         '5', '6', '7', '8']})

df.dtypes
    #A    object
    #B    object
    #C    object
    #dtype: object

df2 = df.copy()
df2[['A', 'B']] = df2.loc[:,['A' , 'B']].astype(float) # Works
df2.dtypes
    #A    float64
    #B    float64
    #C     object
    #dtype: object
df2 = df.copy()
df2.loc[:,['A', 'B']] = df2.loc[:,['A' , 'B']].astype(float) # Does NOT work
df2.dtypes
    #A    object
    #B    object
    #C    object
    #dtype: object
</code></pre>

<p>None of those raise a <code>SettingWithCopy</code> warning. So I'm a little bit confused of why, the <code>df2.loc[:, ['A', 'B']]</code> assignment has no effect. </p>

<p>On closer inspection I do see <strong>that it's not a copy</strong> since in another test, I did assign a dataframe with different values and I they were "saved" in <code>df2</code> but the the <code>dtypes</code> of the <code>df2</code> cannot be "set" via the <code>.loc[:, ['A', 'B']]</code> assignment. </p>

<p>Is there any reason why <code>.loc[:, ['A', 'B']] =</code> assignment doesn't not change dtypes and <code>[['A', 'B']] =</code> does?</p>