The warning goes away if you slice by label (the commented line), and all my reading about the warning doesn't explain why that would be any different. I need to slice by a boolean array, so what am I supposed to do (other than ignore the warning)?
import pandas as pd
x = pd.DataFrame({'A': [0, 1], 'B': [0, 1]})
y = x.loc[[True, False], :]
# y = x.loc[[0], :]
y.loc[:, 'A'] = 1