6

Do they have the same exact effect (other than the fact that only one returns the popped column)? If so, is there ever a reason to use df.drop('x', axis=1,inplace=True) or del df['x']over the more concise df.pop('x')?

James Ronald
  • 685
  • 1
  • 6
  • 13
  • did you test time for very big table ? – furas Mar 05 '20 at 00:16
  • @furas I did not; should I take that to mean that there is no difference in the effects? – James Ronald Mar 05 '20 at 00:28
  • `pop()` returns column and it is difference which may need more time. And more memory. – furas Mar 05 '20 at 00:32
  • 1
    Also touched upon in a few of the answers and comments on [this question](https://stackoverflow.com/questions/13411544/delete-column-from-pandas-dataframe). – AMC Mar 05 '20 at 00:34
  • 1
    Does this answer your question? [python del vs pandas drop](https://stackoverflow.com/questions/47426089/python-del-vs-pandas-drop) – AMC Mar 05 '20 at 00:34

0 Answers0