以下のコードが動きません。
python
1url = 'https://db.netkeiba.com/race/198601010101/' 2print(pd.read_html(url))
エラーコード全文
python
1Traceback (most recent call last): 2 File "D:\801_dev\001_netkeiba\test.py", line 13, in <module> 3 print(pd.read_html(url)) 4 File "C:\Users\oqoqz\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper 5 return func(*args, **kwargs) 6 File "C:\Users\oqoqz\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\html.py", line 1113, in read_html 7 return _parse( 8 File "C:\Users\oqoqz\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\html.py", line 944, in _parse 9 ret.append(_data_to_frame(data=table, **kwargs)) 10 File "C:\Users\oqoqz\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\html.py", line 823, in _data_to_frame 11 with TextParser(body, header=header, **kwargs) as tp: 12 File "C:\Users\oqoqz\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\parsers\readers.py", line 1351, in TextParser 13 return TextFileReader(*args, **kwds) 14 File "C:\Users\oqoqz\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\parsers\readers.py", line 934, in __init__ 15 self._engine = self._make_engine(f, self.engine) 16 File "C:\Users\oqoqz\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\parsers\readers.py", line 1236, in _make_engine 17 return mapping[engine](f, **self.options) 18 File "C:\Users\oqoqz\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\parsers\python_parser.py", line 115, in __init__ 19 ) = self._infer_columns() 20 File "C:\Users\oqoqz\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\parsers\python_parser.py", line 497, in _infer_columns 21 columns, columns[0], num_original_columns 22IndexError: list index out of range
対象のURLはスクレイピングの対象なのに、なぜか対象じゃない扱いをされてしまい困っています。
解決策あればご教示ください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/07/12 08:45