In the pandas
library many times there is an option to change the object inplace such as with the following statement...
df.dropna(axis=\'index\
Yes, in Pandas we have many functions has the parameter inplace
but by default it is assigned to False
.
So, when you do df.dropna(axis='index', how='all', inplace=False)
it thinks that you do not want to change the orignial DataFrame
, therefore it instead creates a new copy for you with the required changes.
But, when you change the inplace
parameter to True
Then it is equivalent to explicitly say that I do not want a new copy of the
DataFrame
instead do the changes on the givenDataFrame
This forces the Python interpreter to not to create a new DataFrame
But you can also avoid using the inplace
parameter by reassigning the result to the orignal DataFrame
df = df.dropna(axis='index', how='all')