Assignment 4

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 religious events or traditions (see below) for the region of West Milford, New Jersey, 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 West Milford, New Jersey, United States to Ann Arbor, USA. In that case at least one source file must be about West Milford, New Jersey, 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., West Milford, New Jersey, United States and religious events or traditions).
  • 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 religious events or traditions? For this category you might consider calendar events, demographic data about religion in the region and neighboring regions, participation in religious events, or how religious events relate to political events, social movements, or historical events.

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!

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 [14]:
#https://en.wikipedia.org/wiki/History_of_religion_in_the_United_States
#https://nces.ed.gov/programs/digest/d16/tables/dt16_302.60.asp
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

columns = ['Year','Total','2-Year','4-Year']

religous_data = pd.read_excel(r"religous_data_united_states.xlsx")
education_data= (pd.read_excel(r"tabn302.60.xls",
                              skiprows=5,parse_cols="A,B,D,F",
                              names=columns)
                              .dropna(thresh=len(columns)))
education_data['Year'].replace("\.+",'',regex=True,inplace=True)
education_data['Year'].replace("\\\\.+\\\\","",regex=True,inplace=True)
education_data['Year'] = education_data['Year'].str.strip()
education_data['Year'] = education_data['Year'].astype(int)
education_data['4-Year'].replace("---",np.NaN,regex=True,inplace=True)

education_data.set_index('Year',inplace=True)

religous_data.set_index("Religion",inplace=True)

religous_data = religous_data.T

religous_data['total'] = religous_data.T.drop('None').T.apply(np.sum,axis='columns')

religous_data = religous_data.T

fig,ax = plt.subplots()
    
ax.plot(religous_data.loc['None']*100,'-o',c='r',label="Non Believers")

ax2 = ax.twinx()
ax2.plot(education_data['Total'],'-o',label='Total Students')

plt.title("Increase in Percentage of College Enrollment and\n "
          "People Without Religious Affiliation in United States")

ax.set_ylabel("% Population without Religious Beliefs")
ax2.set_ylabel("% 18 to 24 Year-olds Enrolled in College")
ax.set_xlabel("Year")
handles1,labels1 = ax.get_legend_handles_labels()
handles2,labels2 = ax2.get_legend_handles_labels()
plt.legend(handles1 + handles2,labels1 + labels2)
plt.xlim([1970,2015])
plt.show()



In [ ]:


In [ ]: