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.

Tutorials?

I’m thinking about doing some tutorial-type things revolving around some of the free-software tools I use to create visual art. Predominantly I’d focus on inkscape (at least at the moment) since I’ve been enamored with vector graphics on that program for a while. I’m also interested in doing something for inkscape as it was a program I avoided for a long time and there was no reason for the delay. If I can assist anyone out there in picking it up faster the world would truly be a better place.

I’d have to talk about other tools I tend to use like gpick, GIMP, digikam, darktable, and others I’m likely forgetting. Looking back and trying to think about writing out my process for any of these things becomes daunting quickly―I forget how many little processes I’ve enacted over the years that otherwise complicate the explanation of what I’m doing.

For instance, I’ll often prepare images in GIMP (using the G’MIC plugin) prior to vectorizing in inkscape. That single step for me is just a given, but in the context of a tutorial it would require explaining a whole other program and a separate plugin for that program. *Alas!*

bunny-01

But I think others could learn… so I’ll probably do it.