Before working on this assignment please read these instructions fully. In the submission area, you will notice that you can click the link to Preview the Grading for each step of the assignment. This is the criteria that will be used for peer grading. Please familiarize yourself with the criteria before beginning the assignment.
This assignment requires that you to find at least two datasets on the web which are related, and that you visualize these datasets to answer a question with the broad topic of economic activity or measures (see below) for the region of Ann Arbor, Michigan, United States, or United States more broadly.
You can merge these datasets with data from different regions if you like! For instance, you might want to compare Ann Arbor, Michigan, United States to Ann Arbor, USA. In that case at least one source file must be about Ann Arbor, Michigan, United States.
You are welcome to choose datasets at your discretion, but keep in mind they will be shared with your peers, so choose appropriate datasets. Sensitive, confidential, illicit, and proprietary materials are not good choices for datasets for this assignment. You are welcome to upload datasets of your own as well, and link to them using a third party repository such as github, bitbucket, pastebin, etc. Please be aware of the Coursera terms of service with respect to intellectual property.
Also, you are welcome to preserve data in its original language, but for the purposes of grading you should provide english translations. You are welcome to provide multiple visuals in different languages if you would like!
As this assignment is for the whole course, you must incorporate principles discussed in the first week, such as having as high data-ink ratio (Tufte) and aligning with Cairo’s principles of truth, beauty, function, and insight.
Here are the assignment instructions:
- State the region and the domain category that your data sets are about (e.g., Ann Arbor, Michigan, United States and economic activity or measures).
- You must state a question about the domain category and region that you identified as being interesting.
- You must provide at least two links to available datasets. These could be links to files such as CSV or Excel files, or links to websites which might have data in tabular form, such as Wikipedia pages.
- You must upload an image which addresses the research question you stated. In addition to addressing the question, this visual should follow Cairo’s principles of truthfulness, functionality, beauty, and insightfulness.
- You must contribute a short (1-2 paragraph) written justification of how your visualization addresses your stated research question.
What do we mean by economic activity or measures? For this category you might look at the inputs or outputs to the given economy, or major changes in the economy compared to other regions.
1.1 Tips
- Wikipedia is an excellent source of data, and I strongly encourage you to explore it for new data sources.
- Many governments run open data initiatives at the city, region, and country levels, and these are wonderful resources for localized data sources.
- Several international agencies, such as the United Nations, the World Bank, the Global Open Data Index are other great places to look for data.
- This assignment requires you to convert and clean datafiles. Check out the discussion forums for tips on how to do this from various sources, and share your successes with your fellow students!
1.2 Example
Looking for an example? Here’s what our course assistant put together for the Ann Arbor, MI,
USA area using sports and athletics as the topic. Example Solution File
In [1]: import pandas as pd
import matplotlib.pyplot as plt
url_births=’https://raw.githubusercontent.com/hamzaelanssari/dataset_birth_ df_births=pd.read_csv(url_births) url_deaths=’https://raw.githubusercontent.com/hamzaelanssari/dataset_birth_ df_deaths=pd.read_csv(url_deaths)
In [12]: ”’ World Arab df_ARB_births=df_births[df_births[‘Country Code’]==’ARB’] df_ARB_deaths=df_deaths[df_deaths[‘Country Code’]==’ARB’]
# Caribbean Countries df_CSS_births=df_births[df_births[‘Country Code’]==’CSS’] df_CSS_deaths=df_deaths[df_deaths[‘Country Code’]==’CSS’]
# Central Europe and the Baltics df_CEB_births=df_births[df_births[‘Country Code’]==’CEB’] df_CEB_deaths=df_deaths[df_deaths[‘Country Code’]==’CEB’]
#East Asia & Pacific
df_EAS_births=df_births[df_births[‘Country Code’]==’EAS’] df_EAS_deaths=df_deaths[df_deaths[‘Country Code’]==’EAS’]
#European Union df_EUU_births=df_births[df_births[‘Country Code’]==’EUU’] df_EUU_deaths=df_deaths[df_deaths[‘Country Code’]==’EUU’]
#Latin America & Caribbean df_LCN_births=df_births[df_births[‘Country Code’]==’LCN’] df_LCN_deaths=df_deaths[df_deaths[‘Country Code’]==’LCN’]
#North America df_NAC_births=df_births[df_births[‘Country Code’]==’NAC’] df_NAC_deaths=df_deaths[df_deaths[‘Country Code’]==’NAC’] ”’
Out[12]: “
World Arab
df_ARB_births=df_births[df_births[‘Country Code’]==’ARB’]
In [13]: df_births.rename(columns={‘Value’: ‘Value_Births’},inplace=True) df_deaths.rename(columns={‘Value’: ‘Value_Deaths’},inplace=True)
In [14]: #Check empty Birth_Data df_births.isnull().sum()
#Other method df_birth.isnull().values.any()
#Check empty Deaths_Data df_deaths.isnull().sum()
Out[14]: Country Name 0
Country Code 0
Year 0
Value_Deaths 0 dtype: int64
In [17]: #USA df_USA_births=df_births[df_births[‘Country Code’]==’USA’] df_USA_deaths=df_deaths[df_deaths[‘Country Code’]==’USA’]
#CHINA df_CHN_births=df_births[df_births[‘Country Code’]==’CHN’] df_CHN_deaths=df_deaths[df_deaths[‘Country Code’]==’CHN’]
#INDIA df_IND_births=df_births[df_births[‘Country Code’]==’IND’] df_IND_deaths=df_deaths[df_deaths[‘Country Code’]==’IND’]
In [5]:
In [48]: # merge data of births with data of deaths
# USA
df_USA=pd.merge(df_USA_births,df_USA_deaths,on=[‘Year’,’Country Code’,’Cou df_USA.set_index(‘Year’,inplace=True)
# CHINA
df_CHN=pd.merge(df_CHN_births,df_CHN_deaths,on=[‘Year’,’Country Code’,’Cou df_CHN.set_index(‘Year’,inplace=True)
# INDIA
df_IND=pd.merge(df_IND_births,df_IND_deaths,on=[‘Year’,’Country Code’,’Cou df_IND.set_index(‘Year’,inplace=True)
# Set Axis
axis=df_USA.index.tolist() df_CHN
Out[48]: Country Name Country Code Value_Births Value_Deaths
Year
- China CHN 86 25.43
- China CHN 02 14.24
- China CHN 01 10.02
- China CHN 37 10.04
- China CHN 14 11.50
- China CHN 88 9.50
- China CHN 05 8.83
- China CHN 96 8.43
- China CHN 59 8.21
- China CHN 11 8.03
- China CHN 43 7.60
- China CHN 65 7.32
- China CHN 77 7.61
- China CHN 93 7.04
- China CHN 82 7.34
- China CHN 01 7.32
- China CHN 91 7.25
- China CHN 93 6.87
- China CHN 25 6.25
- China CHN 82 6.21
- China CHN 21 6.34
- China CHN 91 6.36
- China CHN 28 6.60
- China CHN 19 6.90
- China CHN 90 6.82
- China CHN 04 6.78
- China CHN 43 6.86
- China CHN 33 6.72
- China CHN 37 6.64
- China CHN 58 6.54
- China CHN 06 6.67
- China CHN 68 6.70
- China CHN 27 6.64
- China CHN 09 6.64
- China CHN 70 6.49
- China CHN 12 6.57
- China CHN 98 6.56
- China CHN 57 6.51
- China CHN 64 6.50
- China CHN 64 6.46
- China CHN 03 6.45
- China CHN 38 6.43
- China CHN 86 6.41
- China CHN 41 6.40
- China CHN 29 6.42
- China CHN 40 6.51
- China CHN 09 6.81
- China CHN 10 6.93
- China CHN 14 7.06
- China CHN 13 7.08
- China CHN 90 7.11
- China CHN 93 7.14
- China CHN 10 7.15
- China CHN 08 7.16
- China CHN 37 7.16
- China CHN 07 7.11
- China CHN 00 7.30
In [47]: fig, ax = plt.subplots(1, figsize=(10, 7))
#colors = [‘green’, ‘red’]
#ax.axis(ymin=0,ymax=100)
# USA ax.plot(axis,df_USA[‘Value_Births’].tolist(),alpha = 0.8, label = ‘USA bir ax.plot(axis,df_USA[‘Value_Deaths’].tolist(),alpha = 0.8, label = ‘USA dea
# CHINA ax.plot(axis,df_CHN[‘Value_Births’].tolist(),alpha = 0.8, label = ‘China b ax.plot(axis,df_CHN[‘Value_Deaths’].tolist(),alpha = 0.8, label = ‘China d
# INDIA ax.plot(axis,df_IND[‘Value_Births’].tolist(),alpha = 0.8, label = ‘India b ax.plot(axis,df_IND[‘Value_Deaths’].tolist(),alpha = 0.8, label = ‘India d ax.legend(loc =’best’, frameon=False,fontsize=13) ax.set_xlabel(‘Years’,fontsize=15) ax.set_ylabel(‘Birth and death rate per 1000 people ‘,fontsize=15) fig.suptitle(‘Births Vs Deaths between 1960-2016’,fontsize=17) plt.show()
Reviews
There are no reviews yet.