Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in "from_place" #158

Open
Nik4002 opened this issue Sep 7, 2023 · 0 comments
Open

Error in "from_place" #158

Nik4002 opened this issue Sep 7, 2023 · 0 comments

Comments

@Nik4002
Copy link

Nik4002 commented Sep 7, 2023

When using the from_place method in the ACS object, some cities cause errors if the user does not specify the place_type, that city will not produce any results. This issue occurs for cities that have both an Incorporated Place and a County Subdivision that represent exactly the same place with the same geometries, place ID, etc. For example, Detroit has this problem. When I try to run acs.from_place("Detroit, MI") (acs being an API connection to the ACS), this error is produced:

/usr/local/lib/python3.10/dist-packages/cenpy/products.py:993: UserWarning: Cannot disambiguate placename Detroit. Picking the shortest, best matched placename, Detroit city, from Detroit city, Detroit city
  warn(
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/cenpy/tiger.py](https://localhost:8080/#) in query(self, raw, strict, **kwargs)
    191         try:
--> 192             features = datadict["features"]
    193         except KeyError:

KeyError: 'features'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
3 frames
[/usr/local/lib/python3.10/dist-packages/cenpy/tiger.py](https://localhost:8080/#) in query(self, raw, strict, **kwargs)
    196             if details is []:
    197                 details = "Mapserver provided no detailed error"
--> 198             raise KeyError(
    199                 (
    200                     r"Response from API is malformed. You may have "

KeyError: 'Response from API is malformed. You may have submitted too many queries, formatted the request incorrectly, or experienced significant network connectivity issues. Check to make sure that your inputs, like placenames, are spelled correctly, and that your geographies match the level at which you intend to query. The original error from the Census is:\\n(API ERROR 400:Unable to complete operation.([]))'

Although this error is solvable by specifying the desired place_type in the from_place function call, it could be more user-friendly to remove duplicate places in the table that result from fuzzy-string-matching the name to the master place table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant