Assignment Into Thin Air

Running on pandas 3.0, where copy-on-write is enabled and cannot be turned off.

import pandas as pd

df = pd.DataFrame({"qty": [1, 2, 3], "price": [4, 5, 6]})
df["qty"][df["price"] > 5] = 100
print(df["qty"].tolist())

What happens?

A

Nothing prints: the statement raises ChainedAssignmentError and the program stops.

B

[1, 2, 3] prints, and pandas emits a ChainedAssignmentError warning.

C

[1, 2, 100] prints, along with a SettingWithCopyWarning.

D

[1, 2, 100] prints, with no warning at all.