質問編集履歴

1

変更点追加

2020/09/18 08:38

投稿

PPAP_AWS
PPAP_AWS

スコア105

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,9 @@
1
+ 参考動画を元に勉強してるのですが、8:10で躓いてまして、解決策を教えてください。
2
+
3
+ [参考動画](https://www.youtube.com/watch?v=-x88kBpG0Bw&t=333s)
4
+
5
+
6
+
1
7
  以下のコードを実行したのですが、エラーが出てしまいます。
2
8
 
3
9
  原因等ご教授お願いします。
@@ -5,6 +11,38 @@
5
11
 
6
12
 
7
13
  ```Python
14
+
15
+ import pandas as pd
16
+
17
+ import numpy as np
18
+
19
+ import talib as ta
20
+
21
+ from pandas_datareader import data
22
+
23
+ import matplotlib.pyplot as plt
24
+
25
+ %matplotlib inline
26
+
27
+ import warnings
28
+
29
+ warnings.simplefilter('ignore')
30
+
31
+
32
+
33
+ start = '2019-07-01'
34
+
35
+ end = '2020-07-01'
36
+
37
+
38
+
39
+ df = data.DataReader('^N225', 'yahoo', start, end)
40
+
41
+
42
+
43
+ df.head(10)
44
+
45
+
8
46
 
9
47
  date=df.index
10
48
 
@@ -26,9 +64,41 @@
26
64
 
27
65
  df['sma03'] = Close.rollig(window=span03).mean()
28
66
 
29
-
67
+ (エラー内容)
30
68
 
69
+ AttributeError Traceback (most recent call last)
70
+
71
+ <ipython-input-12-c065fdd176e2> in <module>
72
+
73
+ 3 span03=50
74
+
75
+ 4
76
+
77
+ ----> 5 df['sma01'] = Close.rollig(window=span01).mean()
78
+
79
+ 6 df['sma02'] = Close.rollig(window=span02).mean()
80
+
81
+ 7 df['sma03'] = Close.rollig(window=span03).mean()
82
+
83
+
84
+
85
+ ~/anaconda3/lib/python3.7/site-packages/pandas/core/generic.py in __getattr__(self, name)
86
+
87
+ 5065 if self._info_axis._can_hold_identifiers_and_holds_name(name):
88
+
89
+ 5066 return self[name]
90
+
91
+ -> 5067 return object.__getattribute__(self, name)
92
+
93
+ 5068
94
+
95
+ 5069 def __setattr__(self, name, value):
96
+
97
+
98
+
31
- AttributeError: 'Series' object has no attribute 'rollig' (エラー内容)
99
+ AttributeError: 'Series' object has no attribute 'rollig'
100
+
101
+
32
102
 
33
103
 
34
104