Please consider this example:
import numpy as np
import pandas as pd
df = pd.DataFrame([1,2,3,4,5], columns=["col"])
df[df["col"] == 3]["col"] = 11 # Does not work.
df["col"][df["col"] == 3] = 55 # Does work!
Although the assignments differ in their results, the underlying selections yield the same result:
df[df["col"] == 3]["col"] # Looks like the same as
df["col"][df["col"] == 3] # this
Why does one way work and the other does not?