Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exporting forecast data from darts

I am trying to export the forecasts I made with Pytorch models in darts library to some exchangeable format like XLS or CSV.

Is it somehow possible to export the predictions from the Timeseries class? How can I specify output format?

like image 979
TheMP Avatar asked Sep 07 '26 19:09

TheMP


1 Answers

Forecasts in Darts are nothing but regular TimeSeries objects and a TimeSeries is internally represented as a pandas.DataFrame.

You can access this DataFrame using series.pd_dataframe() (to get a copy of the DataFrame) or series._df directly if you want to avoid copying the DataFrame to save it. Be careful in the latter case however, as modifying the DataFrame in place will break the TimeSeries immutability.

You can then use any method you'd like to save pandas dataframes, e.g. pandas.DataFrame.to_csv() or pandas.DataFrame.to_pickle(). You can have a look at this article on Medium to see a comparison of a couple different formats' performances for saving and loading dataframes.

like image 172
Nap Avatar answered Sep 10 '26 09:09

Nap



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!