About this question
Medium · Code Analysis · Quant Trader interview question · pandas, data-manipulation, copy-vs-view, settingwithcopywarning
You are analyzing historical stock data using Pandas. You have a DataFrame df containing 'price' and other columns. You attempt to add a 'flag' column to rows where the 'price' is greater than 100, setting the 'flag' to True. However, after executing the following code, you observe that the original DataFrame df remains unchanged. Why does the assignment dfdf'price' > 100'flag' = True not modify the original DataFrame df?