Dataframe not returned from get_water_use()
putmanannie opened this issue · 1 comments
Today I tried using the get_water_use() function
from dataretrieval import nwis
wudict = {'AZ':['Mohave', 'Graham', 'Cochise', 'Pinal', 'Gila',
'Maricopa', 'Yavapai'],
'NM':['Catron', 'Grant'],
'UT':['Washington']}
for state in wudict.keys():
counties = wudict[state]
wu = nwis.get_water_use(years='ALL', state=state, counties=counties,
categories='ALL')
wu_df = wu[0]
and the return did not produce a dataframe, instead I got something that was coerced to a dataframe (wu_df) but is definitely not the return I was looking for (see image below for picture of what was returned).
What's going on here? I tried updating the package, but that didn't solve it.
thanks,
Annie
@putmanannie I can't provide clarity on what the return you obtained is, but I can note that the get_water_use()
function expects the input for the "counties" keyword argument to be the county ID, rather than the name of the county (see the docstring). This is admittedly a bit onerous to look up and figure out (see https://help.waterdata.usgs.gov/code/county_query?fmt=html), adding an automatic conversion from county name to county ID for the API call would be a nice bit of functionality to add to the package.
Hope that helps, let me know if we can close the issue.