🎫

What does "inplace=True" mean? 

2024/06/03に公開

1. First

This time is a light article. I've seen inplace many times in somewhere when programing studying, but I couldn't understand it so I looked into it.

2. Inplace

I'll show from conclution.
If you inplace=True, your input is used as input as is, you specified inplace=False, a copy of your input is created and it is used as input instead of input you provide.(Usualy, default is inplace=False)

Why?:
The input of some algorithm is often changed by operation in the algorithm. This is not prefer in general scene, so a lot of library's default setting is being False.
However, inplace=True is more efficient than False, so it is better we use it when without probrem if input is changed.

3. Summary

Settings inplace=True indicate it using input as is.

Discussion