Run a script quickly from second time onward

Advertisements

I have a python script that takes a lot of time to complete.
The line that takes most of the time is:

ndf['embeddings'] = ndf['embeddings'].apply(ast.literal_eval) 

Is there any way to pickle the results so that I will have to wait only for the first time?

>Solution :

sure

ndf.to_pickle("mydf.pkl")

should do just that

you can then load it with pandas.read_pickle("mydf.pkl")

Leave a Reply Cancel reply