0

I'm running the below code with .loc on jupyter to:

a) create a new column

b) rerun for alterations

dc5mshift_business.loc[:,"Trading"] = ((dc5mshift_business.index.hour > 1) & (dc5mshift_business.index.hour < 23))

However, the setting with copy warning comes up when the cell is runned the first two times and I dont think it comes up after that.

Neither creation of new column nor chain indexing seems to explain the 2nd time warning so I'm seeking an explanation and solution.

smaillis
  • 298
  • 3
  • 12
  • This has been asked a lot on SO. Somewhere you defined `dc5mshift_business = a_bigger_df[some_condition]` or something similar. Chain that with `.copy()` and the warning should go away. – Quang Hoang Sep 09 '22 at 03:11

0 Answers0