我正在做一个教程,我有一个问题: 我的代码:
import html5lib
import quandl
import pandas as pd
import pickle
pd.read_html("https://simple.wikipedia.org/wiki/List_of_U.S._states")
main_df = pd.DataFrame()
fiddy_states = pd.read_html('https://simple.wikipedia.org/wiki/List_of_U.S._states')
for abbv in fiddy_states[0][0][1:]:
query = "FMAC/HPI_"+str(abbv)
df = quandl.get(query)
if main_df.empty:
main_df = df
else:
main_df = pd.merge (main_df , df, how = "right")
print(pd.merge(main_df))
我的错误是:
TypeError: merge() missing 1 required positional argument: 'right'
怎么了?
right
基本上是指右边的数据帧。在您的情况下,应该从merge命令中删除df
,然后选择right=df
。这会奏效的。相关问题 更多 >
编程相关推荐