jtleider / censusdata

Download data from Census API
MIT License
139 stars 29 forks source link

Is rental data available? #46

Open arainboldt opened 1 year ago

arainboldt commented 1 year ago

Hi,

I've looked through the documentation but I can't seem to find if the data shown in the link below is available via the API:

https://data.census.gov/table?q=Renter+Costs&g=0100000US$04000$001_040XX00US01&y=2022

Any ideas?

Thanks

vengroff commented 1 year ago

If you want to try censusdis it is pretty straightforward to get the data in the link you posted. Something like the following code does the trick.

import censusdis.data as ced
from censusdis.datasets import ACS1
from censusdis.states import AL

YEAR = 2022
GROUP = "B25031"

df = ced.download(ACS1, YEAR, group=GROUP, state=AL)

I put a demo notebook that does this into the project in the pull request https://github.com/vengroff/censusdis/pull/165. It should be merged and show up in the project source soon.

vengroff commented 1 year ago

If you are interested in learning more about censusdis there is a tutorial video at https://www.youtube.com/watch?v=3vyC7ON0Tvg. It includes a demo notebook that you can launch and run as you follow along.

vengroff commented 1 year ago

The PR is now merged. See the demo notebook at https://github.com/vengroff/censusdis/blob/main/notebooks/Renter%20Costs.ipynb.

MorganWeiss commented 10 months ago

@vengroff Is your package censusdis similar to this package? I want to reliably download census data but I also want to have the geoid as well which you can get from the package by parsing out the Location+Type variable

vengroff commented 10 months ago

Hi @MorganWeiss. The geography to which each row of data corresponds is included right in the row in the data table that is returned. For example, following up on the rental data query that began this thread, if you look at https://github.com/vengroff/censusdis/blob/main/notebooks/Renter%20Costs.ipynb you will see how geometry is returned.

If you want a more general introduction, please have a look at the censusdis-tutorial project. It is also on video on YouTube.

There are three notebooks and a full video going through them. If you want to skip the video and have a quick look at how geography is handled, take a look at Tutorial.ipynb. It starts with a look at getting data at different geography levels and plotting it on maps.