I have a dataframe df and I want to write it into a csv file and load back:
import pandas as pd
import tempfile
with tempfile.NamedTemporaryFile() as temp:
df.to_csv(temp.name + '.csv')
data = pd.read_csv(temp.name + '.csv')
For some reason I do see the tempfile in my tmp/ directory.
Please advise what should I do to eliminate it when I finish with the with
scope?