Day: March 27, 2020

  • Sonnet #001

    By Kyle R. Conway on 2020-03-22 Sunday in GNU Emacs

    When stuck in time between a tunnel’s light
    and each escape obscured by mortal dread
    from whence shall solace torch a flame so bright
    alleviating anxiousness in head?

    Must nothing happen as all sit and watch
    such silent and invisible true foes
    encroach so quietly and cut each notch
    by stealing life breath underneath each nose

    Uncertainty―uncertain though it seems―
    may be a sort of blessing so disguised
    to see beyond collective, fevered dreams
    and poems composed in fear soliloquized.
    By writing I will quell my anxious mind:
    immortalized anxiety enshrined!

  • pandas, COVID-19, and plotting

    # Import Libraries
    import pandas as pd
    import matplotlib
    
    # Magic Code for Inline Display
    # in Jupyter Notebook (if you're using that)
    %matplotlib inline
    
    # Create Dataframe from tables at URL for Iowa COVID-19 Testing
    url = 'https://covidtracking.com/data/state/iowa/#history'
    df = pd.read_html(url)
    
    # There are multiple tables on the page,
    # and they are saved in a list.
    # Choose the 2nd table and rename to 'df'
    df = df[1]
    
    # Set the type for the column 'Date' as a datetime type.
    df['Date'] = pd.to_datetime(df['Date'])
    
    # Set the newly typed "Date" column as the index.
    df.index = df['Date']
    
    # Create a new dataframe from the original with only
    # the 'Pending','Negative', and 'Positive' columns
    iowa_testing = df[['Pending','Negative','Positive']]
    
    # Plot this new dataframe as a stacked bar graph 
    # Invert the axis so time moves forward.
    iowa_testing.plot.bar(stacked=True).invert_xaxis()

    It outputs something that looks like this.