Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pandas/errors/cow.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

4 statements  

1_chained_assignment_msg = ( 

2 "A value is being set on a copy of a DataFrame or Series " 

3 "through chained assignment.\n" 

4 "Such chained assignment never works to update the original DataFrame or " 

5 "Series, because the intermediate object on which we are setting values " 

6 "always behaves as a copy (due to Copy-on-Write).\n\n" 

7 "Try using '.loc[row_indexer, col_indexer] = value' instead, to perform " 

8 "the assignment in a single step.\n\n" 

9 "See the documentation for a more detailed explanation: " 

10 "https://pandas.pydata.org/pandas-docs/stable/user_guide/" 

11 "copy_on_write.html#chained-assignment" 

12) 

13 

14 

15_chained_assignment_method_msg = ( 

16 "A value is being set on a copy of a DataFrame or Series " 

17 "through chained assignment using an inplace method.\n" 

18 "Such inplace method never works to update the original DataFrame or Series, " 

19 "because the intermediate object on which we are setting values always " 

20 "behaves as a copy (due to Copy-on-Write).\n\n" 

21 "For example, when doing 'df[col].method(value, inplace=True)', try " 

22 "using 'df.method({col: value}, inplace=True)' instead, to perform " 

23 "the operation inplace on the original object, or try to avoid an inplace " 

24 "operation using 'df[col] = df[col].method(value)'.\n\n" 

25 "See the documentation for a more detailed explanation: " 

26 "https://pandas.pydata.org/pandas-docs/stable/user_guide/" 

27 "copy_on_write.html" 

28) 

29 

30 

31_chained_assignment_method_update_msg = ( 

32 "A value is being set on a copy of a DataFrame or Series " 

33 "through chained assignment using an inplace method.\n" 

34 "Such inplace method never works to update the original DataFrame or Series, " 

35 "because the intermediate object on which we are setting values always " 

36 "behaves as a copy (due to Copy-on-Write).\n\n" 

37 "For example, when doing 'df[col].update(other)', try " 

38 "using 'df.update({col: other})' instead, to perform " 

39 "the operation inplace on the original object.\n\n" 

40 "See the documentation for a more detailed explanation: " 

41 "https://pandas.pydata.org/pandas-docs/stable/user_guide/" 

42 "copy_on_write.html" 

43)