Extrapolation of Time Series in Python I have the following plot in time series and would like to extrapolate it to derive a value in X[n+20], for instance. I tried poly fitting it but extrapolation does come out correct that way. Any proposed approaches?  
The data comes from blood glucose after a meal overtime, it usually starts at some value, say 90mg/dl at mealtime, peaks to 150mg/dl, then decreases down to some value which can be less than the intial 90mg/dl. Since we have several post-meal signals which all start at different values, we aligned them by substracting the offset so that we can derive a general curve fit for them all, of course it will only be an approximation and that is fine. x is time.
\begin{array}{cc}
 0 & 0. \\
 5 & 4.3 \\
 10 & 12.7 \\
 15 & 22.1 \\
 20 & 32.6 \\
 25 & 41. \\
 30 & 47.8 \\
 35 & 50. \\
 40 & 51.9 \\
 45 & 52. \\
 50 & 51.2 \\
 55 & 45.4 \\
 60 & 43.4 \\
 65 & 39.9 \\
 70 & 40.2 \\
 75 & 35.4 \\
 80 & 30.2 \\
 85 & 27.9 \\
 90 & 25. \\
 95 & 19.6 \\
 100 & 15.8 \\
 105 & 13.9 \\
 110 & 9.1 \\
 115 & 4. \\
 120 & 1.6 \\
 125 & -1.4 \\
 130 & -4. \\
 135 & -5.6 \\
 140 & -6.8 \\
 145 & -7.7 \\
 150 & -8.6 \\
 155 & -10.4 \\
 160 & -10.9 \\
 165 & -10.9 \\
 170 & -10.2 \\
 175 & -10.2 \\
 180 & -10.3 \\
 185 & -10.7 \\
\end{array}
 A: What you are doing is forecasting. Judging from what you write in the comments, forecasting this series is not truly a statistical problem, but a biological one. Best to model the dynamics giving rise to this curve and then extrapolate these out.
From a purely statistical/forecasting standpoint, the best you can probably do is the so-called naive or random-walk forecast: project the last observation out in a flat line. If you want to, use the smoothed value.
(And even if you do use a nice complex model, it makes sense to compare its predictions out-of-sample to a simple benchmark like the naive forecast. You find surprisingly often that the simple benchmark outperforms a more complex approach.)
A: Old Ans. The Y data takes negative values.  You could try fitting $Y+11.0$ or more generally $Y+Y_{min}$ with a gamma distribution which may also need an offset. Without more information, it is guesswork. Either show tabular data or forget getting a good answer, not clear enough.
After comments, edits and more information.
OK, you can try a less than critically damped sine wave. 
Here, for example is $$A \exp (-\lambda  t) \sin (\omega  t+\theta )$$ where $\{A\to -98.0396,\lambda \to 0.0126426,\omega \to 0.0259994,\theta \to 3.08326\}$
This is the result of assuming that glucose is a less than critically damped negative feedback network moderated by insulin. Caution, this is a quick and dirty answer and attention should be paid to residual and error types, whether or not the data is proportional and myriad other factors.

For example, you might be better served by getting rid of the {0,0} first point, and let the algorithm decide at what time, $t$, the first root of the equation is zero, as this may not be when you think it occurs. Why? If you think about it for a moment, the zero concentration first root is implied by each and every data entry already, so that entering {0,0} is redundant, arbitrary and misleading. Moreover, the feedback loop may not occur in linear time, but in time to some power. Doing those things we obtain
$$A \exp \left(-\lambda  x^B\right) \sin \left(\omega  x^B+\theta \right)\;,$$
where $\{A\to -104.526,B\to 0.936079,\lambda \to 0.0178241,\omega \to -0.0362561,\theta \to 0.14761\}$

Where the start time is 4.07133 min, and the correlation between model and data is $r=0.99783$. If you want to find any particular predicted concentration, just input that time in the formula. 
Keep in mind that this is just an ordinary least squares model, that it is quick and dirty, that I have not examined the original data and its error structure, and that I prefer biological models where $r^2\geq0.999+$ unless there is some outstanding reason (e.g., demonstrated to be noise) why it cannot be that precise. Many of my colleagues are happy when they get $r\geq0.8$, however, that is all too often due to a lack of proper modelling, and not because of noise. In this data, the precision of the concentration data is sometimes only one or two decimal places, and a subtraction (which doubles the error) has been performed. Without better data, it would be hard to exceed the $r^2=0.995665$ found. That is, in this case, the last 1/2% explained fraction would be harder to obtain. Sorry, I use Mathematica, not Python. If you want the Mathematica code, let me know.
