Python pandas df.copy() ist not deep
问题 I have (in my opinion) a strange problem with python pandas. If I do: cc1 = cc.copy(deep=True) for the dataframe cc and than ask a certain row and column: print(cc1.loc['myindex']['data'] is cc.loc['myindex']['data']) I get True What's wrong here? 回答1: Deep copying doesn't work in pandas and the devs consider putting mutable objects inside a DataFrame as an antipattern There is nothing wrong in your code, just in case if you want to know the difference with some example of deep and shallow