title: Pandas "SettingWithCopyWarning" not fixable with .loc accessor
body: <p>I have a DataFrame with a DateTimeIndex and I what to add an additional column with the calendar week of the Index to the DataFrame.
  My current approach is the following code and it works as expected:</p>
  
  <pre><code>output_df['week_number'] = output_df.index.week
  </code></pre>
  
  <p>However I receive the following warning:</p>
  
  <pre><code>SettingWithCopyWarning: 
  A value is trying to be set on a copy of a slice from a DataFrame.
  Try using .loc[row_indexer,col_indexer] = value instead
  </code></pre>
  
  <p>I´ve already tried to fix it by changing to </p>
  
  <pre><code>output_df['week_number'] = output_df.index.week.copy()
  </code></pre>
  
  <p>but it doesn´t change anything.</p>
  
  <p>Furthermore following the advice and changing to the .loc-accessor:</p>
  
  <pre><code>output_df.loc[:,'week_number'] = output_df.index.week
  </code></pre>
  
  <p>results in another warning:</p>
  
  <pre><code>SettingWithCopyWarning: 
  A value is trying to be set on a copy of a slice from a DataFrame.
  Try using .loc[row_indexer,col_indexer] = value instead
  See the caveats in the documentation: http://pandas.pydata.org/pandas- 
  docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[key] = _infer_fill_value(value)
  
  SettingWithCopyWarning: 
  A value is trying to be set on a copy of a slice from a DataFrame.
  Try using .loc[row_indexer,col_indexer] = value instead
  See the caveats in the documentation: http://pandas.pydata.org/pandas- 
  docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
  </code></pre>
  
  <p>What is the correct way to avoid this warning? Thank you for your help.</p>