0

I have a situation, in this moment i have a lot of variables in my python environment, i want to to remove this variables with some function. I know that in R i use the function rm() to remove all variables i want. The question is, Is there such a variable like that in python?.

For example,

import pandas as pd

df = pd.DataFrame()

Here i create a object, now i want remove it of the python environment, i have used list.remove(df).

Thank you.

hrbrmstr
  • 77,368
  • 11
  • 139
  • 205

1 Answers1

1

If I understand correctly, you are looking for the del function:

>>> df = pd.DataFrame()
>>> df
Empty DataFrame
Columns: []
Index: []
>>> del df
>>> df
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'df' is not defined
sacuL
  • 49,704
  • 8
  • 81
  • 106