title: Can't fill nan values in pandas even with inplace flag
body: <p>I have a pandas dataframe containing NaN values for some column.
  I'm trying to fill them with a default value (30), but it doesn't work.</p>
  <p>Original dataframe:</p>
  <pre><code>                  type               avg_speed  
  
  0                 CAR                     32.0  
  1                 CAR                      NaN  
  2                 CAR                      NaN  
  3                 BIKE                    16.2  
  4                 CAR                     28.5  
  5                 SCOOTER                 29.7  
  6                 CAR                     30.7  
  7                 CAR                      NaN  
  8                 BIKE                     NaN  
  9                 BIKE                    35.1
  ...
  </code></pre>
  <p>Desired result:</p>
  <pre><code>                  type               avg_speed  
  
  0                 CAR                     32.0  
  1                 CAR                       30  
  2                 CAR                       30  
  3                 BIKE                    16.2  
  4                 CAR                     28.5  
  5                 SCOOTER                 29.7  
  6                 CAR                     30.7  
  7                 CAR                       30  
  8                 BIKE                      30  
  9                 BIKE                    35.1
  </code></pre>
  <p>My code:</p>
  <pre><code>def fill_with_default(pandas_df, column_name, default_value):
      print(f&quot;Total count: {pandas_df.count()}&quot;)
      print(f&quot;Count of Nan BEFORE: {pandas_df[column_name].isna().sum()}&quot;)
  
      pandas_df[column_name].fillna(default_value, inplace=True)
  
      print(f&quot;Count of Nan AFTER: {pandas_df[column_name].isna().sum()}&quot;)
  
      return pandas_df
  
  df = fill_with_default(df, &quot;avg_speed&quot;, 30)
  </code></pre>
  <p>Output:</p>
  <pre><code>Total count: 105018
  Count of Nan BEFORE: 49514
  Count of Nan AFTER: 49514
  </code></pre>
  <p>The chain of dataframe transformations and list of columns are too long, so it's difficult to show all steps (join with another dataframe, drop useless columns, add usefull columns, join with other dataframes, filter etc.)</p>
  <p>I've tried other options but they also don't work:</p>
  <pre><code>#pandas_df.fillna({column_name: default_value}, inplace=True)
  #pandas_df.loc[pandas_df[column_name].isnull(),column_name] = default_value
  ...
  </code></pre>
  <p>Type of column before applying &quot;fillna&quot; is fload64, the same as default_value</p>
  <p>Therefore, my question is: what could be the potential reasons of this problem?
  What kind of transformation can lead to this problem? Because this is the method that works for another similar data frame. The only difference between them lies in the chain of transformations.</p>
  <p>BTW, there is a system log at this place:</p>
  <pre><code>/home/hadoop/.local/lib/python3.6/site- 
  packages/pandas/core/generic.py:6287: SettingWithCopyWarning: 
  A value is trying to be set on a copy of a slice from a DataFrame
  
  See the caveats in the documentation: 
  http://pandas.pydata.org/pandas- 
  docs/stable/user_guide/indexing.html#returning-a-view-versus-a- 
  copy
  self._update_inplace(new_data)
  </code></pre>