Skip to content

Commit 0c3bf51

Browse files
committed
API: catch target kwarg clobbering
1 parent 356fa4a commit 0c3bf51

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pandas/core/generic.py

+3
Original file line numberDiff line numberDiff line change
@@ -2100,6 +2100,9 @@ def sample(self, n=None, frac=None, replace=False, weights=None, random_state=No
21002100
def pipe(self, func, *args, **kwargs):
21012101
if isinstance(func, tuple):
21022102
func, target = func
2103+
if target in kwargs:
2104+
msg = '%s is both the pipe target and a keyword argument' % target
2105+
raise ValueError(msg)
21032106
kwargs[target] = self
21042107
return func(*args, **kwargs)
21052108
else:

0 commit comments

Comments
 (0)