Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 584
Image: ubuntu2004
Kernel: Python 3 (system-wide)
# Stuff that will appear at the top of notebooks; from datascience import * import numpy as np %matplotlib inline import matplotlib.pyplot as plots plots.style.use('fivethirtyeight') import warnings warnings.simplefilter(action="ignore", category=FutureWarning) from urllib.request import urlopen import re def read_url(url): return re.sub('\\s+', ' ', urlopen(url).read().decode())
# Import data to covid # https://data.cdc.gov/api/views/9mfq-cb36/rows.csv covid = Table.read_table('Provisional.csv') covid
Data As Of Start Date End Date Group Year Month State Sex Age Group COVID-19 Deaths Total Deaths
4/28/2021 1/1/2020 4/24/2021 By Total nan nan United States All Sexes All Ages 557486 4.35558e+06
4/28/2021 1/1/2020 4/24/2021 By Total nan nan United States All Sexes Under 1 year 66 23862
4/28/2021 1/1/2020 4/24/2021 By Total nan nan United States All Sexes 0-17 years 277 41811
4/28/2021 1/1/2020 4/24/2021 By Total nan nan United States All Sexes 1-4 years 34 4286
4/28/2021 1/1/2020 4/24/2021 By Total nan nan United States All Sexes 5-14 years 98 6930
4/28/2021 1/1/2020 4/24/2021 By Total nan nan United States All Sexes 15-24 years 844 44906
4/28/2021 1/1/2020 4/24/2021 By Total nan nan United States All Sexes 18-29 years 2097 79315
4/28/2021 1/1/2020 4/24/2021 By Total nan nan United States All Sexes 25-34 years 3741 92911
4/28/2021 1/1/2020 4/24/2021 By Total nan nan United States All Sexes 30-39 years 6089 113155
4/28/2021 1/1/2020 4/24/2021 By Total nan nan United States All Sexes 35-44 years 9724 133834

... (52316 rows omitted)

# Put data in folder mydata = Table.read_table('state_governors2021.csv') mydata
Order State Governor Party Inauguration End of term Term limits
1 Alabama Kay Ivey Republican 10-Apr-17 2023 y
3 Alaska Mike Dunleavy Republican 3-Dec-18 2023 y
5 Arizona Doug Ducey Republican 5-Jan-15 2023 n
7 Arkansas Asa Hutchinson Republican 13-Jan-15 2023 n
9 California Gavin Newsom Democratic 7-Jan-19 2023 y
11 Colorado Jared Polis Democratic 8-Jan-19 2023 y
13 Connecticut Ned Lamont Democratic 9-Jan-19 2023 y
15 Delaware John Carney Democratic 17-Jan-17 2025 n
17 Florida Ron DeSantis Republican 8-Jan-19 2023 y
19 Georgia Brian Kemp Republican 14-Jan-19 2023 y

... (40 rows omitted)

my_bar = mydata.group(['Party', 'End of term']).sort('End of term') my_bar
Party End of term count
Democratic 2022 4
Democratic 2023 15
Republican 2023 20
Democratic 2024 1
Republican 2024 2
Democratic 2025 3
Republican 2025 5
my_bar.select(0, 1, 2).barh(0)
Image in a Jupyter notebook
mydata.pivot('End of term', 'Party')
Party 2022 2023 2024 2025
Democratic 4 15 1 3
Republican 0 20 2 5
# Import data # https://data.cdc.gov/api/views/9bhg-hcku/rows.csv