1

I'd like to analyze the development of COVID-19 cases in Austria by state, in respect to the designation of "risk areas" as defined by the Federal Foreign Office of Germany. According to that definition, "risk areas" are areas with "more than 50 new infections per 100,000 inhabitants in the last seven days" (PDF file provided by Robert Koch Institute). So, to assess if an austrian state may be in danger of being declared a "risk area", one has to compute the count of new infections in relation to the total population.

There's an open data set available at data.gv.at that enumerates the cases per state ("COVID-19: Anzahl der aktuell Erkrankten je Bundesland"), but only for the current day.

I've found a page that analyzes the case counts per state (coronatracker.at), but they don't provide raw data and they don't compute the count of new infections per seven days retrospectively.

So, does anybody know if there a dataset of new infections per austrian state for the (let's say) last three months?

1 Answer 1

1

I wrote a python3 scraper for the https://coronatracker.at site that gets the individual states' data. The code is really a wrapper for the amazing pandas function .read_html(), which does basically everything by reading the table from the html.

The CSV could be cleaned up (e.g. splitting some columns that contain multiple data points together 42.545 +191 (0%)), but you'll notice that there are individual Bundesländer (labeled as column "state") and also daily counts per state. It may not be the data you are exactly looking for, but at least now the raw data is "available". The data goes back to February, 2020.

also here for a reference:

import requests
import pandas as pd

# scraping individual states from:
# https://www.coronatracker.at/

# manually got each state's name from the site dropdown Bundesländer 
states = ['burgenland','kaernten','niederoesterreich','oberoesterreich',
            'salzburg','steiermark','tirol','vorarlberg','wien']

headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
s = requests.Session()
url_base = 'https://www.coronatracker.at/'

big_df = []
# loop over all states, aka url paths
for state in states:
    print(state)
    url = url_base + state

    # make request
    r = s.get(url, headers=headers)

    # convert html to dataframe, thanks pandas
    # add [0] because read_html() returns a list of dataframes
    df = pd.read_html(r.content)[0]

    # add state to dataframe
    df['state'] = state
    df['url'] = url

    # add to list of states
    big_df.append(df)

# concat all dataframes
df = pd.concat(big_df)

df.to_csv('at.csv',index=False)
#print(df)
8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.