【发布时间】:2020-02-04 17:32:32
【问题描述】:
import quandl
import pandas as pd
fiddy_states = pd.read_html('https://www.infoplease.com/us/postal-information/state-abbreviations-and-state-postal-codes')
print(fiddy_states[0][0])
我收到一个我无法理解的错误。因为我是新手,所以我找不到解决方案。 我只想要 url 表中的邮政编码列。
【问题讨论】:
-
那么你得到的错误是什么?
-
这是错误的第 1 部分 - Traceback(最近一次调用最后一次):文件“C:\Users\MOCHI\AppData\Local\Programs\Python\Python37-32\lib\site-packages \pandas\core\indexes\base.py",第 2897 行,在 get_loc 中返回 self._engine.get_loc(key) 文件 "pandas_libs\index.pyx",第 107 行,在 pandas._libs.index.IndexEngine.get_loc 文件中" pandas_libs\hashtable_class_helper.pxi”,第 1607 行,在 pandas._libs.hashtable.PyObjectHashTable.get_item 文件“pandas_libs\hashtable_class_helper.pxi”,第 1614 行,在 pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 0
-
文件“pandas_libs\index.pyx”,第 107 行,在 pandas._libs.index.IndexEngine.get_loc 文件“pandas_libs\index.pyx”,第 131 行,在 pandas._libs.index.IndexEngine .get_loc 文件“pandas_libs\hashtable_class_helper.pxi”,第 1607 行,在 pandas._libs.hashtable.PyObjectHashTable.get_item 文件“pandas_libs\hashtable_class_helper.pxi”,第 1614 行,在 pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 0
-
将错误信息放在您的帖子中以获得更多关注,而不是在评论部分。
标签: python html pandas dataframe