質問編集履歴
13
更新
title
CHANGED
File without changes
|
body
CHANGED
@@ -154,4 +154,45 @@
|
|
154
154
|
331 if keys is None:
|
155
155
|
|
156
156
|
ValueError: No objects to concatenate
|
157
|
+
```
|
158
|
+
|
159
|
+
```python
|
160
|
+
以下が2framesを開いたエラー表記です。
|
161
|
+
|
162
|
+
2424 ブラス
|
163
|
+
2018
|
164
|
+
No data
|
165
|
+
2019
|
166
|
+
No data
|
167
|
+
---------------------------------------------------------------------------
|
168
|
+
ValueError Traceback (most recent call last)
|
169
|
+
<ipython-input-68-b8a81eea83a2> in <module>()
|
170
|
+
45 print(k,v)
|
171
|
+
46 dfs = get_dfs(k)
|
172
|
+
---> 47 data = concatenate(dfs)
|
173
|
+
48 data.to_csv('{}-{}.csv'.format(k,v))
|
174
|
+
|
175
|
+
2 frames
|
176
|
+
<ipython-input-68-b8a81eea83a2> in concatenate(dfs)
|
177
|
+
29
|
178
|
+
30 def concatenate(dfs):
|
179
|
+
---> 31 data = pd.concat(dfs,axis=0)
|
180
|
+
32 data = data.reset_index(drop=True)
|
181
|
+
33 col = ['始値','高値','安値','終値','出来高','終値調整']
|
182
|
+
|
183
|
+
/usr/local/lib/python3.6/dist-packages/pandas/core/reshape/concat.py in concat(objs, axis, join, ignore_index, keys, levels, names, verify_integrity, sort, copy)
|
184
|
+
279 verify_integrity=verify_integrity,
|
185
|
+
280 copy=copy,
|
186
|
+
--> 281 sort=sort,
|
187
|
+
282 )
|
188
|
+
283
|
189
|
+
|
190
|
+
/usr/local/lib/python3.6/dist-packages/pandas/core/reshape/concat.py in __init__(self, objs, axis, join, keys, levels, names, ignore_index, verify_integrity, copy, sort)
|
191
|
+
327
|
192
|
+
328 if len(objs) == 0:
|
193
|
+
--> 329 raise ValueError("No objects to concatenate")
|
194
|
+
330
|
195
|
+
331 if keys is None:
|
196
|
+
|
197
|
+
ValueError: No objects to concatenate
|
157
198
|
```
|
12
エラーを追加しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -125,4 +125,33 @@
|
|
125
125
|
44 v = code_list.loc[i,'name']
|
126
126
|
|
127
127
|
NameError: name 'code_list' is not defined
|
128
|
+
```
|
129
|
+
|
130
|
+
```python
|
131
|
+
以下がエラーです。次は上のこちらの部分に赤線がひいて
|
132
|
+
ありました。→data = pd.concat(dfs,axis=0)
|
133
|
+
|
134
|
+
|
135
|
+
2424 ブラス
|
136
|
+
2019
|
137
|
+
No data
|
138
|
+
2020
|
139
|
+
No data
|
140
|
+
---------------------------------------------------------------------------
|
141
|
+
ValueError Traceback (most recent call last)
|
142
|
+
<ipython-input-67-3b125c0fc7ed> in <module>()
|
143
|
+
45 print(k,v)
|
144
|
+
46 dfs = get_dfs(k)
|
145
|
+
---> 47 data = concatenate(dfs)
|
146
|
+
48 data.to_csv('{}-{}.csv'.format(k,v))
|
147
|
+
|
148
|
+
2 frames
|
149
|
+
/usr/local/lib/python3.6/dist-packages/pandas/core/reshape/concat.py in __init__(self, objs, axis, join, keys, levels, names, ignore_index, verify_integrity, copy, sort)
|
150
|
+
327
|
151
|
+
328 if len(objs) == 0:
|
152
|
+
--> 329 raise ValueError("No objects to concatenate")
|
153
|
+
330
|
154
|
+
331 if keys is None:
|
155
|
+
|
156
|
+
ValueError: No objects to concatenate
|
128
157
|
```
|
11
更新
title
CHANGED
File without changes
|
body
CHANGED
@@ -109,4 +109,20 @@
|
|
109
109
|
|
110
110
|
FileNotFoundError: [Errno 2] File codelist.csv does not exist: 'codelist.csv'
|
111
111
|
|
112
|
+
```
|
113
|
+
|
114
|
+
```python
|
115
|
+
以下がエラーです。
|
116
|
+
エラーが出た際、
|
117
|
+
上のfor i in range(len(code_list)):のコードの部分に赤線が引かれていました。
|
118
|
+
|
119
|
+
NameError Traceback (most recent call last)
|
120
|
+
<ipython-input-55-b9a24c2bba32> in <module>()
|
121
|
+
40
|
122
|
+
41 #複数のデータフレームをcsvで保存
|
123
|
+
---> 42 for i in range(len(code_list)):
|
124
|
+
43 k = code_list.loc[i,'code']
|
125
|
+
44 v = code_list.loc[i,'name']
|
126
|
+
|
127
|
+
NameError: name 'code_list' is not defined
|
112
128
|
```
|
10
更新
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
|
26
26
|
import csv
|
27
27
|
|
28
|
-
csvfile = open('/content/drive/My Drive/google cora/
|
28
|
+
csvfile = open('/content/drive/My Drive/google cora/code_list.csv')
|
29
29
|
|
30
30
|
reader = csv.DictReader(csvfile)
|
31
31
|
for row in reader:
|
9
更新
title
CHANGED
File without changes
|
body
CHANGED
@@ -69,7 +69,7 @@
|
|
69
69
|
return data
|
70
70
|
|
71
71
|
#作成したコードリストを読み込む
|
72
|
-
|
72
|
+
code_list = pd.read_csv('code_list.csv')
|
73
73
|
|
74
74
|
#複数のデータフレームをcsvで保存
|
75
75
|
for i in range(len(code_list)):
|
8
更新
title
CHANGED
File without changes
|
body
CHANGED
@@ -69,7 +69,7 @@
|
|
69
69
|
return data
|
70
70
|
|
71
71
|
#作成したコードリストを読み込む
|
72
|
-
|
72
|
+
codelist = pd.read_csv('codelist.csv')
|
73
73
|
|
74
74
|
#複数のデータフレームをcsvで保存
|
75
75
|
for i in range(len(code_list)):
|
7
更新
title
CHANGED
File without changes
|
body
CHANGED
@@ -81,8 +81,9 @@
|
|
81
81
|
data.to_csv('{}-{}.csv'.format(k,v))
|
82
82
|
```
|
83
83
|
|
84
|
-
```
|
84
|
+
```python
|
85
85
|
|
86
|
+
以下がエラーとして出てきました。
|
86
87
|
|
87
88
|
---------------------------------------------------------------------------
|
88
89
|
---------------------------------------------------------------------------
|
6
更新
title
CHANGED
File without changes
|
body
CHANGED
@@ -79,9 +79,11 @@
|
|
79
79
|
dfs = get_dfs(k)
|
80
80
|
data = concatenate(dfs)
|
81
81
|
data.to_csv('{}-{}.csv'.format(k,v))
|
82
|
+
```
|
82
83
|
|
84
|
+
```以下がエラーとして出てきました。
|
83
85
|
|
84
|
-
|
86
|
+
|
85
87
|
---------------------------------------------------------------------------
|
86
88
|
---------------------------------------------------------------------------
|
87
89
|
FileNotFoundError Traceback (most recent call last)
|
5
更新
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
](0aa2c6503b87b174cf8bd61cefa8bddf.png)
|
15
15
|
|
16
16
|
|
17
|
+
|
18
|
+
|
17
19
|
```python
|
18
20
|
|
19
21
|
from google.colab import drive
|
@@ -102,4 +104,6 @@
|
|
102
104
|
|
103
105
|
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()
|
104
106
|
|
105
|
-
FileNotFoundError: [Errno 2] File codelist.csv does not exist: 'codelist.csv'
|
107
|
+
FileNotFoundError: [Errno 2] File codelist.csv does not exist: 'codelist.csv'
|
108
|
+
|
109
|
+
```
|
4
現在の状況に更新しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -23,34 +23,12 @@
|
|
23
23
|
|
24
24
|
import csv
|
25
25
|
|
26
|
-
csvfile = open('/content/drive/My Drive/google cora/
|
26
|
+
csvfile = open('/content/drive/My Drive/google cora/codelist.csv')
|
27
|
+
|
27
28
|
reader = csv.DictReader(csvfile)
|
28
|
-
|
29
29
|
for row in reader:
|
30
|
-
|
30
|
+
print(row)
|
31
31
|
|
32
|
-
以下が出てきたエラーです。
|
33
|
-
---------------------------------------------------------------------------
|
34
|
-
UnicodeDecodeError Traceback (most recent call last)
|
35
|
-
<ipython-input-6-474e9fa87ab0> in <module>()
|
36
|
-
4 reader = csv.DictReader(csvfile)
|
37
|
-
5
|
38
|
-
----> 6 for row in reader:
|
39
|
-
7 print(row)
|
40
|
-
|
41
|
-
2 frames
|
42
|
-
/usr/lib/python3.6/codecs.py in decode(self, input, final)
|
43
|
-
319 # decode input (taking the buffer into account)
|
44
|
-
320 data = self.buffer + input
|
45
|
-
--> 321 (result, consumed) = self._buffer_decode(data, self.errors, final)
|
46
|
-
322 # keep undecoded input until the next call
|
47
|
-
323 self.buffer = data[consumed:]
|
48
|
-
|
49
|
-
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 16: invalid start byte
|
50
|
-
|
51
|
-
_____________________________
|
52
|
-
以上までがエラー
|
53
|
-
|
54
32
|
from bs4 import BeautifulSoup
|
55
33
|
import pandas as pd
|
56
34
|
import requests
|
@@ -103,11 +81,12 @@
|
|
103
81
|
|
104
82
|
以下がエラーとして出てきました。
|
105
83
|
---------------------------------------------------------------------------
|
84
|
+
---------------------------------------------------------------------------
|
106
85
|
FileNotFoundError Traceback (most recent call last)
|
107
|
-
<ipython-input-
|
86
|
+
<ipython-input-46-64a85a5b6de8> in <module>()
|
108
87
|
37
|
109
88
|
38 #作成したコードリストを読み込む
|
110
|
-
---> 39
|
89
|
+
---> 39 codelist = pd.read_csv('codelist.csv')
|
111
90
|
40
|
112
91
|
41 #複数のデータフレームをcsvで保存
|
113
92
|
|
@@ -123,5 +102,4 @@
|
|
123
102
|
|
124
103
|
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()
|
125
104
|
|
126
|
-
FileNotFoundError: [Errno 2] File
|
105
|
+
FileNotFoundError: [Errno 2] File codelist.csv does not exist: 'codelist.csv'
|
127
|
-
```
|
3
画像の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -11,7 +11,9 @@
|
|
11
11
|
何も分からず恐縮ですが、ご回答いただけたら幸いです。
|
12
12
|
|
13
13
|
|
14
|
+
](0aa2c6503b87b174cf8bd61cefa8bddf.png)
|
14
15
|
|
16
|
+
|
15
17
|
```python
|
16
18
|
|
17
19
|
from google.colab import drive
|
2
csvを読み込んだ際のエラーを追加しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,6 +13,42 @@
|
|
13
13
|
|
14
14
|
|
15
15
|
```python
|
16
|
+
|
17
|
+
from google.colab import drive
|
18
|
+
drive.mount('/content/drive')
|
19
|
+
|
20
|
+
Mounted at /content/drive
|
21
|
+
|
22
|
+
import csv
|
23
|
+
|
24
|
+
csvfile = open('/content/drive/My Drive/google cora/code_list.csv')
|
25
|
+
reader = csv.DictReader(csvfile)
|
26
|
+
|
27
|
+
for row in reader:
|
28
|
+
print(row)
|
29
|
+
|
30
|
+
以下が出てきたエラーです。
|
31
|
+
---------------------------------------------------------------------------
|
32
|
+
UnicodeDecodeError Traceback (most recent call last)
|
33
|
+
<ipython-input-6-474e9fa87ab0> in <module>()
|
34
|
+
4 reader = csv.DictReader(csvfile)
|
35
|
+
5
|
36
|
+
----> 6 for row in reader:
|
37
|
+
7 print(row)
|
38
|
+
|
39
|
+
2 frames
|
40
|
+
/usr/lib/python3.6/codecs.py in decode(self, input, final)
|
41
|
+
319 # decode input (taking the buffer into account)
|
42
|
+
320 data = self.buffer + input
|
43
|
+
--> 321 (result, consumed) = self._buffer_decode(data, self.errors, final)
|
44
|
+
322 # keep undecoded input until the next call
|
45
|
+
323 self.buffer = data[consumed:]
|
46
|
+
|
47
|
+
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 16: invalid start byte
|
48
|
+
|
49
|
+
_____________________________
|
50
|
+
以上までがエラー
|
51
|
+
|
16
52
|
from bs4 import BeautifulSoup
|
17
53
|
import pandas as pd
|
18
54
|
import requests
|
1
マークダウン記法にしました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,6 +10,9 @@
|
|
10
10
|
こちらはどの点が間違えておりますでしょうか。
|
11
11
|
何も分からず恐縮ですが、ご回答いただけたら幸いです。
|
12
12
|
|
13
|
+
|
14
|
+
|
15
|
+
```python
|
13
16
|
from bs4 import BeautifulSoup
|
14
17
|
import pandas as pd
|
15
18
|
import requests
|
@@ -82,4 +85,5 @@
|
|
82
85
|
|
83
86
|
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()
|
84
87
|
|
85
|
-
FileNotFoundError: [Errno 2] File code_list.csv does not exist: 'code_list.csv'
|
88
|
+
FileNotFoundError: [Errno 2] File code_list.csv does not exist: 'code_list.csv'
|
89
|
+
```
|