You need to fit a curve to those points using your chosen model. It sounds like you want scipy's curve_fit maybe? matplotlib is for plotting, not curve fitting. But that and the plotting are nothing to do with Spark here. Spark gives you the data as pandas so you can use all these tools as you like.
On Tue, Jan 5, 2021 at 9:38 AM Mich Talebzadeh <mich.talebza...@gmail.com> wrote: > Thanks again > > Just to clarify, I want to see the average price for year 2021, 2022 etc > based on the best fit. So naively if someone asked a question what the > average price will be in 2022, I should be able to make some predictions. > > I can of course crudely use pen and pencil like shown in the attached > figure, but I was wondering if this is possible with anything that > matplotlib offers? > > > > [image: Capture123.PNG] > > > > *Disclaimer:* Use it at your own risk. Any and all responsibility for any > loss, damage or destruction of data or any other property which may arise > from relying on this email's technical content is explicitly disclaimed. > The author will in no case be liable for any monetary damages arising from > such loss, damage or destruction. > > > > > On Tue, 5 Jan 2021 at 15:22, Sean Owen <sro...@gmail.com> wrote: > >> You will need to use matplotlib on the driver to plot in any event. If >> this is a single extrapolation, over 11 data points, you can just use Spark >> to do the aggregation, call .toPandas, and do whatever you want in the >> Python ecosystem to fit and plot that result. >> >>>