質問編集履歴

1

追記

2020/02/20 08:12

投稿

Pablito
Pablito

スコア71

test CHANGED
File without changes
test CHANGED
@@ -216,9 +216,103 @@
216
216
 
217
217
  元データの’を消してみたり、したのですが効果はなし。
218
218
 
219
- dateがdatetime型なのですが
220
-
221
- これをint型に変える必要あるのでょうか?
219
+ dateがdatetime型なので、
220
+
221
+ 以下のコードでint型にしたところ、違うエラー返ってきまた。
222
+
223
+ ```
224
+
225
+ def to_integer(dt_time):
226
+
227
+ return 10000*dt_time.year + 100*dt_time.month + dt_time.day
228
+
229
+
230
+
231
+ guests['date'] = guests['date'].apply(to_integer)
232
+
233
+ ```
234
+
235
+
236
+
237
+ ```
238
+
239
+ ---------------------------------------------------------------------------
240
+
241
+ ValueError Traceback (most recent call last)
242
+
243
+ <ipython-input-12-d64133e2c242> in <module>
244
+
245
+ 3
246
+
247
+ 4 #最尤法によるパラメーターの推定
248
+
249
+ ----> 5 res_local_level = mod_local_level.fit()
250
+
251
+ 6
252
+
253
+ 7 #推定されたパラメーター一覧
254
+
255
+
256
+
257
+ c:\users\lib\site-packages\statsmodels\tsa\statespace\mlemodel.py in fit(self, start_params, transformed, includes_fixed, cov_type, cov_kwds, method, maxiter, full_output, disp, callback, return_params, optim_score, optim_complex_step, optim_hessian, flags, low_memory, **kwargs)
258
+
259
+ 605 """
260
+
261
+ 606 if start_params is None:
262
+
263
+ --> 607 start_params = self.start_params
264
+
265
+ 608 transformed = True
266
+
267
+ 609 includes_fixed = True
268
+
269
+
270
+
271
+ c:\users\lib\site-packages\statsmodels\tsa\statespace\structural.py in start_params(self)
272
+
273
+ 846 _start_params = {}
274
+
275
+ 847 if self.level:
276
+
277
+ --> 848 resid, trend1 = hpfilter(endog)
278
+
279
+ 849
280
+
281
+ 850 if self.stochastic_trend:
282
+
283
+
284
+
285
+ c:\users\lib\site-packages\statsmodels\tsa\filters\hp_filter.py in hpfilter(x, lamb)
286
+
287
+ 88 """
288
+
289
+ 89 pw = PandasWrapper(x)
290
+
291
+ ---> 90 x = array_like(x, 'x', ndim=1)
292
+
293
+ 91 nobs = len(x)
294
+
295
+ 92 I = sparse.eye(nobs, nobs) # noqa:E741
296
+
297
+
298
+
299
+ c:\users\lib\site-packages\statsmodels\tools\validation\validation.py in array_like(obj, name, dtype, ndim, maxdim, shape, order, contiguous, optional)
300
+
301
+ 134 if arr.ndim != ndim:
302
+
303
+ 135 msg = '{0} is required to have ndim {1} but has ndim {2}'
304
+
305
+ --> 136 raise ValueError(msg.format(name, ndim, arr.ndim))
306
+
307
+ 137 if shape is not None:
308
+
309
+ 138 for actual, req in zip(arr.shape, shape):
310
+
311
+
312
+
313
+ ValueError: x is required to have ndim 1 but has ndim 2
314
+
315
+ ```
222
316
 
223
317
 
224
318