In a given data frame mydf, I removed a column from the data frame through:
mydf.drop('Z', axis=1)
However, in the following parts, the removed column Z is still there, e.g., when I write print(mydf.sum()) after the previous cell, it gives me the sum of column Z with the sum of other columns. How can I delete the column Z permanently?
.dropby default returns a new dataframe. specifyinplace=Trueif you don't want to re-assignmydf