teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

2020/12/05 11:42

投稿

remoro
remoro

スコア5

title CHANGED
File without changes
body CHANGED
@@ -85,6 +85,7 @@
85
85
  filename2=filename.replace(chr(92),"/")
86
86
  ```
87
87
  を用いて置換したが同様のエラーが発生した。
88
+ パスを直接書き込む場合は失敗しない
88
89
 
89
90
  ### 補足情報(FW/ツールのバージョンなど)
90
91
 

1

エラーメッセージの記入漏れ修正

2020/12/05 11:42

投稿

remoro
remoro

スコア5

title CHANGED
File without changes
body CHANGED
@@ -3,7 +3,59 @@
3
3
  ### 発生している問題・エラーメッセージ
4
4
 
5
5
  ```
6
- エラーメッセージ
6
+ ---------------------------------------------------------------------------
7
+ ValueError Traceback (most recent call last)
8
+ <ipython-input-3-365cc4cf31ce> in <module>
9
+ 5
10
+ 6 for filename in all_files:
11
+ ----> 7 df = pd.read_json(filename, orient='records', lines=True)
12
+ 8 li.append(df)
13
+ 9
14
+
15
+ ~\anaconda3\lib\site-packages\pandas\util\_decorators.py in wrapper(*args, **kwargs)
16
+ 212 else:
17
+ 213 kwargs[new_arg_name] = new_arg_value
18
+ --> 214 return func(*args, **kwargs)
19
+ 215
20
+ 216 return cast(F, wrapper)
21
+
22
+ ~\anaconda3\lib\site-packages\pandas\io\json\_json.py in read_json(path_or_buf, orient, typ, dtype, convert_axes, convert_dates, keep_default_dates, numpy, precise_float, date_unit, encoding, lines, chunksize, compression)
23
+ 606 return json_reader
24
+ 607
25
+ --> 608 result = json_reader.read()
26
+ 609 if should_close:
27
+ 610 filepath_or_buffer.close()
28
+
29
+ ~\anaconda3\lib\site-packages\pandas\io\json\_json.py in read(self)
30
+ 727 elif self.lines:
31
+ 728 data = ensure_str(self.data)
32
+ --> 729 obj = self._get_object_parser(self._combine_lines(data.split("\n")))
33
+ 730 else:
34
+ 731 obj = self._get_object_parser(self.data)
35
+
36
+ ~\anaconda3\lib\site-packages\pandas\io\json\_json.py in _get_object_parser(self, json)
37
+ 751 obj = None
38
+ 752 if typ == "frame":
39
+ --> 753 obj = FrameParser(json, **kwargs).parse()
40
+ 754
41
+ 755 if typ == "series" or obj is None:
42
+
43
+ ~\anaconda3\lib\site-packages\pandas\io\json\_json.py in parse(self)
44
+ 855
45
+ 856 else:
46
+ --> 857 self._parse_no_numpy()
47
+ 858
48
+ 859 if self.obj is None:
49
+
50
+ ~\anaconda3\lib\site-packages\pandas\io\json\_json.py in _parse_no_numpy(self)
51
+ 1106 else:
52
+ 1107 self.obj = DataFrame(
53
+ -> 1108 loads(json, precise_float=self.precise_float), dtype=None
54
+ 1109 )
55
+ 1110
56
+
57
+ ValueError: No ':' found when decoding object value
58
+
7
59
  ```
8
60
 
9
61
  ### 該当のソースコード
@@ -15,7 +67,7 @@
15
67
  li = []
16
68
 
17
69
  for filename in all_files:
18
- df = pd.read_json(filename2, orient='records', lines=True)
70
+ df = pd.read_json(filename, orient='records', lines=True)
19
71
  li.append(df)
20
72
 
21
73
  frame = pd.concat(li, axis=0, ignore_index=True)