DataFrame index must be unique for orient='index'

hello~I am trying to use the HQ model for my research,I downloaded the sample data from the official website and I was able to run it successfully. But my own data, it shows error. I don’t know what’s wrong. Help me! Thank you all~

My data and where it’s stored

Hi @sun, and welcome to the forum!

That’s an interesting error. Please post the entire log file (ends in .txt) that the model produces in your Workspace. It contains more information that might help us understand what’s going wrong. Thanks!

~ Stacie

InVEST-Habitat-Quality-log-2021-06-09–22_08_24.txt (1.8 KB)
thanks for your reply!

Thanks for posting your logfile @sun. It includes this error message:

2021-06-09 22:08:24,529 utils.build_lookup_from_csv(544) ERROR The ‘key_field’ : ‘threat’ column values are not unique: [‘a’, ‘r’, ‘g’, ‘t’, ‘u’, ’ ', ’ ']

It looks like you have two columns with blank field names, which I’m guessing contain no corresponding threat data either, so they could be deleted. So I recommend looking at your threat table, and make sure that the columns are formatted correctly, with unique column names (and no blank column names). Sometimes it’s hard to see problems when looking at the table in Excel, so I recommend viewing it in a text editor (like Notepad in Windows), where you can more easily see the actual .csv formatting.

~ Stacie

2 Likes

Dear @swolny ,
I currently have the same type of error, but in the urban flood risk mitigation model.
I attach you the log and the biof. table.
I tried as you suggested to revise the formatting of the biophysical table but there doesn’t seem to be anything wrong.

InVEST-Urban-Flood-Risk-Mitigation-log-2022-01-28–16_04_01.txt (5.6 KB)

Biophysical table_urbanFlood.csv (552 Bytes)

Do you have any suggestions?
Thanks for your attention

Antonio

@swolny
The only thing I can think of is that the “lucode” is quite long (e.g. 11000). Could it be that it doesn’t recognize it?

Okay, found. I had put the lucode 33000 class more than once. I continue to correct the other errors :wink:

3 Likes