質問編集履歴

2

正規表現:」と”の間への空欄の追加

2017/11/20 06:23

投稿

syu-yu
syu-yu

スコア24

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  import pandas as pd
28
28
 
29
- pattern = re.compile('^\S+ \S+ \S+ [(.*)]"(.*)" (\S+) (\S+)$')
29
+ pattern = re.compile('^\S+ \S+ \S+ [(.*)] "(.*)" (\S+) (\S+)$')
30
30
 
31
31
  def parse_access_log(path):
32
32
 

1

不明点の追加

2017/11/20 06:23

投稿

syu-yu
syu-yu

スコア24

test CHANGED
File without changes
test CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- つまづいていること:
5
+ 不明点:
6
6
 
7
- エラー:DataFrame constructor not properly called!の表示になってしまうこと。
7
+ エラー:Shape of passed values is (1, 2), indices imply (4, 2)
8
+
9
+ ⓶ここでのyeildの意味。(検索してもイマイチ理解ができませんでした。)
8
10
 
9
11
 
10
12
 
@@ -32,18 +34,10 @@
32
34
 
33
35
  for m in pattern.finditer(line):
34
36
 
35
- return m.group()
37
+ yeild m.group()
36
38
 
37
39
 
38
40
 
39
41
  columns = ['time','request','status','bytes']
40
42
 
41
43
  pd.DataFrame(parse_access_log('access_log.txt'),columns=columns)
42
-
43
-
44
-
45
- 出力が
46
-
47
- DataFrame constructor not properly called!
48
-
49
- になってしまいます。