US Patent Office has been inconsistent in how they format publicly available yearly statistics. I needed to scrape data to use in an econ project.
In the sheets directory, you can find yearly patent statistics for each state and DC. The scraper can be modified to get patent numbers for foreign countries, although I had to avoid those numbers for my own research.