Discussions

Ask a Question
Back to All

problems with stock prediction

I need some help , I use yfinance as stockdata and got this error message:


ValueError Traceback (most recent call last)
Input In [57], in <cell line: 1>()
----> 1 nixtla_client.plot(df, time_col="Date", target_col="Close")

File ~\anaconda3\lib\site-packages\nixtla\nixtla_client.py:2172, in NixtlaClient.plot(self, df, forecasts_df, id_col, time_col, target_col, unique_ids, plot_random, max_ids, models, level, max_insample_length, plot_anomalies, engine, resampler_kwargs, ax)
2170 plot_anomalies = True
2171 models = ["TimeGPT"]
-> 2172 return plot_series(
2173 df=df,
2174 forecasts_df=forecasts_df,
2175 ids=unique_ids,
2176 plot_random=plot_random,
2177 max_ids=max_ids,
2178 models=models,
2179 level=level,
2180 max_insample_length=max_insample_length,
2181 plot_anomalies=plot_anomalies,
2182 engine=engine,
2183 resampler_kwargs=resampler_kwargs,
2184 palette="tab20b",
2185 id_col=id_col,
2186 time_col=time_col,
2187 target_col=target_col,
2188 ax=ax,
2189 )

File ~\anaconda3\lib\site-packages\utilsforecast\plotting.py:147, in plot_series(df, forecasts_df, ids, plot_random, max_ids, models, level, max_insample_length, plot_anomalies, engine, palette, id_col, time_col, target_col, seed, resampler_kwargs, ax)
145 raise ValueError("At least one of df and forecasts_df must be provided.")
146 elif df is not None:
--> 147 validate_format(df, id_col, time_col, target_col)
148 elif forecasts_df is not None:
149 validate_format(forecasts_df, id_col, time_col, None)

File ~\anaconda3\lib\site-packages\utilsforecast\validation.py:109, in validate_format(df, id_col, time_col, target_col)
107 missing_cols = sorted(expected_cols - set(df.columns))
108 if missing_cols:
--> 109 raise ValueError(f"The following columns are missing: {missing_cols}")
111 # time col
112 if not _is_dt_or_int(df[time_col]):

ValueError: The following columns are missing: ['Close', 'Date', 'unique_id']

Could some one help, I can not fix it.

Thanks.