Skip to content

clip inplace? #15388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cnsgsz opened this issue Feb 14, 2017 · 4 comments · Fixed by #16462
Closed

clip inplace? #15388

cnsgsz opened this issue Feb 14, 2017 · 4 comments · Fixed by #16462
Labels
API Design Numeric Operations Arithmetic, Comparison, and Logical operations
Milestone

Comments

@cnsgsz
Copy link

cnsgsz commented Feb 14, 2017

Is it possible to support clip in place, just like numpy does? I assume that would speed up working with large dataframe/series as no extra copies will be needed.

If not, is that a workaround to achieve the same effect? I tried np.clip(df.values,-clip_bounds.values, clip_bounds.values, out=df.values), but realized that df.values is actually an expensive call as it is merging blocks underneath.

@jreback
Copy link
Contributor

jreback commented Feb 14, 2017

virtually all methods in pandas return new objects, exception are indexing. inplace does not provide ANY benefit, and should never have been added as it provides no utility and serves to confuse people.

so no, won't be adding any more inplace ops.

@jreback jreback closed this as completed Feb 14, 2017
@jreback jreback modified the milestones: wont, won't fix Feb 14, 2017
@jreback jreback added Numeric Operations Arithmetic, Comparison, and Logical operations API Design labels Feb 14, 2017
@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Feb 14, 2017

@jreback this clip function is actually one of rare methods where having an inplace arg actually would make sense, IMO (since it is possible to do it 'really' in place, opposed to something like sorting)

And it would also not be difficult to add, as DataFrame.where (which is what clip uses under the hood) already supports inplace.

@jreback
Copy link
Contributor

jreback commented Feb 14, 2017

I am ok with it - @cnsgsz if you would like to do an implementation would be great

@jreback jreback reopened this Feb 14, 2017
@jreback jreback modified the milestones: Next Major Release, won't fix Feb 14, 2017
@guygoldberg
Copy link
Contributor

Starting to work on it

guygoldberg added a commit to guygoldberg/pandas that referenced this issue May 23, 2017
guygoldberg added a commit to guygoldberg/pandas that referenced this issue May 23, 2017
guygoldberg added a commit to guygoldberg/pandas that referenced this issue May 24, 2017
guygoldberg added a commit to guygoldberg/pandas that referenced this issue May 24, 2017
guygoldberg added a commit to guygoldberg/pandas that referenced this issue May 25, 2017
guygoldberg added a commit to guygoldberg/pandas that referenced this issue May 25, 2017
@jreback jreback modified the milestones: 0.21.0, Next Major Release May 25, 2017
stangirala pushed a commit to stangirala/pandas that referenced this issue Jun 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants