Proper way to slice and modify a dataframe
#### Code Sample, a copy-pastable example if possible

```python
1.
import pandas as pd

df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
df

def f(df_par):
    df_par.iloc[0, 0] = 8

mask = df.iloc[:, 0] > 1
mask = mask.tolist()
df = df.loc[mask,:]
f(df)

2.

import pandas as pd

df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
print(df)

def f(df_par):
    df_par.iloc[0, 0] = 8

mask = df.iloc[:, 0] > 1
mask = mask.tolist()
df = df.loc[mask,:]
f(df)

```
#### Problem description

Hello, I am using pandas 0.24.2. I would like to know what is the correct way to slice and modify a dataframe and not a view. In particular I am using the loc as suggested in the documentation and if I execute the code 1 I get the warning: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

Is it possible to do that kind of slice and update of the dataframe and be sure that I am updating correctly the dataframe?

If I execute f(df.copy(deep=True)) I do not get the waning but it is not very efficient.

Why if I execute the version 2 of the code I do not get the warning?

Thank you.

