Skip to content

Commit 4bbd02f

Browse files
Apply suggestions from code review
Co-authored-by: Irv Lustig <[email protected]>
1 parent 04ad61e commit 4bbd02f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

web/pandas/pdeps/0008-inplace-methods-in-pandas.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ for this PDEP, we can distinguish two kinds of "inplace" operations:
104104
Object-inplace operations, while not actually modifying existing column values, keep
105105
(a subset of) those columns and thus can avoid copying the data of those existing columns.
106106

107-
In addition, several methods supporting the ``inplace`` keyword cannot actually be done inplace (in neither meaning)
107+
In addition, several methods supporting the ``inplace`` keyword cannot actually be done inplace (in either meaning)
108108
because they make a copy as a
109109
consequence of the operations they perform, regardless of whether ``inplace`` is ``True`` or not. This, coupled with the
110110
fact that the ``inplace=True`` changes the return type of a method from a pandas object to ``None``, makes usage of
@@ -177,7 +177,7 @@ return a new object referencing the same data.
177177
| `eval` |
178178
| `query` |
179179

180-
Although these methods have the `inplace` keyword, they can never operate inplace, in neither meaning, because the nature of the
180+
Although these methods have the `inplace` keyword, they can never operate inplace, in either meaning, because the nature of the
181181
operation requires copying (such as reordering or dropping rows). For those methods, `inplace=True` is essentially just
182182
syntactic sugar for reassigning the new result to the calling DataFrame/Series.
183183

@@ -214,7 +214,7 @@ All references to the original object will go out of scope when the result of th
214214
to `df`. As a consequence, `iloc` will continue to operate inplace, and the underlying data will not be copied (with Copy-on-Write).
215215

216216
**Group 2 (values-inplace)** methods differ, though, since they modify the underlying
217-
data, and therefore can be actually happen inplace:
217+
data, and therefore can actually happen inplace:
218218

219219
:::python
220220
df = pd.DataFrame({"foo": [1, 2, 3]})
@@ -382,7 +382,7 @@ However, the `copy` keyword is not supported in any of the values-mutating metho
382382
unlike `inplace`, so semantics of future inplace mutation of values align better with the current behavior of
383383
the `inplace` keyword, than with the current behavior of the `copy` keyword.
384384

385-
Furthermore, with the Copy-on-Write proposal, the `copy` keyword also has become superfluous. With Copy-on-Write
385+
Furthermore, with the approved Copy-on-Write proposal, the `copy` keyword also has become superfluous. With Copy-on-Write
386386
enabled, methods that return a new pandas object will always try to avoid a copy whenever possible, regardless of
387387
a `copy=False` keyword. Thus, the Copy-on-Write PDEP proposes to actually remove the `copy` keyword from the methods
388388
where it is currently used (so it would be strange to add this as a new keyword to the Group 2 methods).

0 commit comments

Comments
 (0)