|
1 | 1 | _chained_assignment_msg = ( |
2 | 2 | "A value is trying to be set on a copy of a DataFrame or Series " |
3 | 3 | "through chained assignment.\n" |
4 | | - "When using the Copy-on-Write mode, such chained assignment never works " |
5 | | - "to update the original DataFrame or Series, because the intermediate " |
6 | | - "object on which we are setting values always behaves as a copy.\n\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 | 7 | "Try using '.loc[row_indexer, col_indexer] = value' instead, to perform " |
8 | 8 | "the assignment in a single step.\n\n" |
9 | | - "See the caveats in the documentation: " |
| 9 | + "See the documentation for a more detailed explanation: " |
10 | 10 | "https://pandas.pydata.org/pandas-docs/stable/user_guide/" |
11 | | - "copy_on_write.html" |
| 11 | + "copy_on_write.html#chained-assignment" |
12 | 12 | ) |
13 | 13 |
|
14 | 14 |
|
15 | 15 | _chained_assignment_method_msg = ( |
16 | 16 | "A value is trying to be set on a copy of a DataFrame or Series " |
17 | 17 | "through chained assignment using an inplace method.\n" |
18 | | - "When using the Copy-on-Write mode, such inplace method never works " |
19 | | - "to update the original DataFrame or Series, because the intermediate " |
20 | | - "object on which we are setting values always behaves as a copy.\n\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 | 21 | "For example, when doing 'df[col].method(value, inplace=True)', try " |
22 | 22 | "using 'df.method({col: value}, inplace=True)' instead, to perform " |
23 | | - "the operation inplace on the original object.\n\n" |
| 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" |
24 | 28 | ) |
0 commit comments