Yaping Lang

09/04/2023, 7:37 AM
Hi all, I'm new to the project, just got token and experimenting with timegpt, i'm constantly hitting this error , does anyone also encounter this ? I'm just using the sample code . I'm able to get the forecast results. but statsforecast spit some error. I've checked both df, there is no null value.. Appreciate any help .. I'm on python@3.11/3.11.5 , numba 0.57.1. I suspect it is the version issue?
Copy code
Traceback (most recent call last):
  File "/Users/lilypad/Documents/Code/timegpt/", line 19, in <module>
    sf.plot(df, fcst_df, level=[80, 90], max_insample_length=24 * 5)
  File "/opt/homebrew/lib/python3.11/site-packages/statsforecast/", line 1789, in plot
    axes[idx, idy].fill_between(
  File "/opt/homebrew/lib/python3.11/site-packages/matplotlib/", line 1446, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
  File "/opt/homebrew/lib/python3.11/site-packages/matplotlib/axes/", line 5425, in fill_between
    return self._fill_between_x_or_y(
  File "/opt/homebrew/lib/python3.11/site-packages/matplotlib/axes/", line 5330, in _fill_between_x_or_y
    ind, dep1, dep2 = map(
  File "/opt/homebrew/lib/python3.11/site-packages/numpy/ma/", line 2360, in masked_invalid
    return masked_where(~(np.isfinite(getdata(a))), a, copy=copy)
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
python script is :
Copy code
import pandas as pd
import os
from nixtlats import TimeGPT
from statsforecast import StatsForecast as sf


df = pd.read_csv('<>')

timegpt = TimeGPT(token=os.environ['TIMEGPT_TOKEN'])
fcst_df = timegpt.forecast(df, h=24, level=[80, 90])

print("NaN count in df:")
print("NaN count in fcst_df:")

sf.plot(df, fcst_df, level=[80, 90], max_insample_length=24 * 5)
lol i think i know why . 3.11 is not supported yet..

José Morales

09/04/2023, 3:54 PM
Hey. Can you print the types of the fcst_df (
)?. I think the level columns may not be numerical

Max (Nixtla)

09/04/2023, 9:18 PM
Hi @Yaping Lang, thanks for the interestest we are currently in closed beta and are trying to onboard as many users as possible. That means that you probably are getting a 429 error. Something like:
Copy code
  "status": 429,
  "data": null,
  "message": "Too many requests",
  "details": "You have reached your request limit, top up your credits to continue using the API",
  "code": "A20",
  "requestID": ""
If you haven't yet. Could you please fill out the form on our Website so we can process it? Just click on Submit interest on

Yaping Lang

09/06/2023, 3:13 AM
@José Morales, they were float
Copy code
unique_id         object
ds                object
TimeGPT          float64
TimeGPT-lo-90    float64
TimeGPT-lo-80    float64
TimeGPT-hi-80    float64
TimeGPT-hi-90    float64
dtype: object

José Morales

09/06/2023, 10:34 PM
Hmm I think the ds has to be timestamp. Which version of statsforecast are you using?
Also if you can try installing utilsforecast instead (
pip install utilsforecast
) and using:
Copy code
from utilsforecast.plotting import plot_series

plot_series(df, fcst_df, level=[80, 90], max_insample_length=24 * 5)
It'd help us because we're going to replace the statsforecast function with that one and it'd be better to fix the error there if we find one