Overview: In this week, you have studied additional Python language…

1 Home work

Overview: In this week, you have studied additional Python language syntax including File I/O, Exceptions and Object-Oriented Programming. The Lab for this week demonstrates your knowledge of this additional Python functionality. Be sure to use the examples in the textbook reading along with the associate libraries, functions and processes when completing the assignments for this week.

Don't use plagiarized sources. Get Your Custom Essay on
Overview: In this week, you have studied additional Python language…
From as low as $9/Page
Order Essay

Be sure to develop and test your Python code in the AWS Cloud9 IDE provided for the class.

You should continue to use the PEP Python Style guide mentioned in the book and found here:


Some examples of Python Coding Style best practices include:

 Limit all lines to a maximum of 79 characters.

 Imports are always put at the top of the file, just after any module comments and before module globals and constants.

 Use 4 spaces for indentation.

Submission requirements for this project include 4 files. (Zipping them into one file is acceptable and encouraged):

 Python Data Analysis Code

 2 Input Files (Same files supplied to you)

 Word, Excel or PDF file containing your test results

This exercise allows a user to load one of two CSV files and then perform histogram analysis and plots for select variables on the datasets. The first dataset represents the population change for specific dates for U.S. regions. The second dataset represents Housing data over an extended period of time describing home age, number of bedrooms and other variables. The first row provides a column name for each dataset. The following columns should be used to perform analysis:


 Pop Apr 1

 Pop Jul 1

 Change Pop








Notice for the Housing CSV file, there are more columns in the file than are required to be analyzed. You can and should still load each column.

Specific statistics options should include:

 Count

 Mean

 Standard Deviation

 Min

 Max

 Histogram


1. Use the Pandas, Numpy, MatplotLib and other Python modules when appropriate.

2. Since you are running this on a Linux box, you don’t really have a graphical environment. So you will need to save the graphics for display. Notice the plt variable is assigned to fig1 and then the figure is saved. For example:

import numpy as np

import matplotlib.pyplot as plt

# Fixing random state for reproducibility


mu, sigma = 100, 15

x = mu + sigma * np.random.randn(10000)

# the histogram of the data

n, bins, patches = plt.hist(x, 20, density=True, facecolor=’b’, alpha=0.75)


#Assign to a figure


# Save Figure for Download


Once the figure is saved, just download (right mouse click) to save to your desktop for viewing:


3. Be sure to read the content in this week for how to install the Python modules in your Cloud9 IDE. You need to install those modules before you can use them.

The user interface should continue to run until the user indicates they are ready to exit.

A user interface might look similar to this:

***************** Welcome to the Python Data Analysis App**********

Select the file you want to analyze:

1. Population Data

2. Housing Data

3. Exit the Program



You have entered Population Data.

Select the Column you want to analyze:

a. Pop Apr 1

b. Pop Jul 1

c. Change Pop

d. Exit Column


You selected Pop Apr 1

The statistics for this column are:

Count = 10000

Mean = 32.5

Standard Deviation = 4.5

Min = 53.2

Max = 12.5

The Histogram of this column can be downloaded now.

Select the Column you want to analyze:

a. Pop Apr 1

b. Pop Jul 1

c. Change Pop

d. Exit Column


You selected to exit the column menu

Select the file you want to analyze:

1. Population Data

2. Housing Data

3. Exit the Program


*************** Thanks for using the Data Analysis App**********

If an inappropriate entry is detected, the program should prompt for a correct value and continue to do so until a correct value is entered.


Be sure to use a Class (i.e. Object-Oriented Programming) to load your data.

For example, the following code could be part of reading each line of a file after it has been opened:

semesters = list()

with open(filename,’r’) as s:

reader = csv.reader(s)

next(reader) # skip the header

for line in reader:

# Append the soc record to the list

semesters.append(objs.SEMESTER(line)) semesters.append(objs.SEMESTER(line))


# Extract the critical data (maybe all of the data in a class)

def __init__(self, line):

self.data =line

# Go through each element and assign value

self.strm = self.data[0].strip()

self.session = self.data[1].strip()

self.startdate = self.data[2].strip()

self.enddate = self.data[3].strip()

The above code snippets are part of a more comprehensive solution that would include class definitions for each column name for the files. You are welcome to use other approaches but be sure to create dedicated classes for your datasets.

The Homework Writings
Order NOW For A 10% Discount!
Pages (550 words)
Approximate price: -

Our Advantages

Plagiarism Free Papers

All our papers are original and written from scratch. We will email you a plagiarism report alongside your completed paper once done.

Free Revisions

All papers are submitted ahead of time. We do this to allow you time to point out any area you would need revision on, and help you for free.


A title page preceeds all your paper content. Here, you put all your personal information and this we give out for free.


Without a reference/bibliography page, any academic paper is incomplete and doesnt qualify for grading. We also offer this for free.

Originality & Security

At thehomeworkwritings.com, we take confidentiality seriously and all your personal information is stored safely and do not share it with third parties for any reasons whatsoever. Our work is original and we send plagiarism reports alongside every paper.

24/7 Customer Support

Our agents are online 24/7. Feel free to contact us through email or talk to our live agents.

Try it now!

Calculate the price of your order

We'll send you the first draft for approval by at
Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

We work around the clock to see best customer experience.


Flexible Pricing

Our prices are pocket friendly and you can do partial payments. When that is not enough, we have a free enquiry service.


Admission help & Client-Writer Contact

When you need to elaborate something further to your writer, we provide that button.


Paper Submission

We take deadlines seriously and our papers are submitted ahead of time. We are happy to assist you in case of any adjustments needed.


Customer Feedback

Your feedback, good or bad is of great concern to us and we take it very seriously. We are, therefore, constantly adjusting our policies to ensure best customer/writer experience.