Community
Pandas tutorial - part 7 (error message)
by: Chill59, 8 years ago
Last edited: 8 years ago
I'm working through part 7 of the Pandas tutorial and trying to run the following script from that tutorial (sorry, I'm new to programming/Python/Pandas):
import Quandl
import pandas as pd
api_key = open('quandlapikey.txt','r').read()
fiddy_states = pd.read_html('https://simple.wikipedia.org/wiki/List_of_U.S._states')
main_df = pd.DataFrame()
for abbv in fiddy_states[0][0][1:]:
query = "FMAC/HPI_"+str(abbv)
df = Quandl.get(query, authtoken=api_key)
if main_df.empty:
main_df = df
else:
main_df = main_df.join(df)
When I run this script, I get the following error message:
ValueError: columns overlap but no suffix specified: Index([u'Value'], dtype='object')
Any advice/direction on this would be greatly appreciated. Thanks!
×
You must be logged in to post. Please login or register an account.
It is due to the join. Quandl has since changed, and all of their columns are called "value" now, rather than the actual name.
the best solution here is likely to just rename the "value" column to the abbv.
-Harrison 8 years ago
Reply
×
You must be logged in to post. Please login or register an account.
That did the trick! Many thanks! Your Pandas tutorial rocks!
Best regards from Montreal,
Chris
-Chill59 8 years ago
Reply
×
You must be logged in to post. Please login or register an account.
-Nikunja 8 years ago
Last edited 8 years ago
Reply
×
You must be logged in to post. Please login or register an account.