In the Pandas data frame, we created a function to delete all the lower lines of a column when the value of a column appears nan.
And then I put that data frame in df and spin it, but there's no change in the actual data frame.
For example, if the data frame name is df2022 (already defined before adding it to the function), and the column name is 'Determine'
Even if you do shorter (df2022, 'judgment')
df2022 does not change. Why is he doing this? I want to get the result of changing the actual data.dataframe pandas function
What happens here is not to change the df itself, but to create a new
df.loc[0:i-1] and assign it to the name df. The newly created df is irrelevant to the df outside the function. So it doesn't change.
I think this will work.
© 2022 pinfo. All rights reserved.