Question: Assignment 1 Assignment background Write one Python program that answers each of the questions listed below. You can also write multiple programs, one for each
Assignment Assignment background
Write one Python program that answers each of the questions listed below. You can also write
multiple programs, one for each of the Assignment categories ie Nationwide and District In
your output, precede the code to calculate and display your answer with a print statement that
identifies the question number and separates the response answers from that of the previous
section.
If the question asks for a quantity eg "How much money" precede the printed quantity with
a string that clarifies your answer eg "Nancy Pelosi raised: Include all relevant data in your
answers.
For this assignment, you will use the most appropriate OpenFEC dataset for the
campaign. You can download the file from OpenFEC. If you have questions about the
assignment, please post them on the course's Piazza page.
All questions below refer to the congressional campaign.
Remember, you can work with one other student on this assignment, but if you do be sure that
you work on it together, and not split the questions. If you work with another student on this,
please only submit the assignment once and state the identification of both students
Hints
If you are looking to analyze just the congressional candidates from the OpenFEC file,
note that the ID field in the All Candidates data set has an initial character that indicates
the race in which the candidate is running. A string with a leading indicates that this
is a House race. You can reduce the number of rows in your DataFrame by using the loc
operator we covered in class. For example, the following statement will exclude rows
with a and a for Senate and Presidential races:
dfhousedflocdfIDI
Assignment due
Assigned: February
Due: March : PM
Nationwide Analyses
Which individual raised the most campaign money? How much money?
a Is this individual a Republican or Democrat?
b Is this individual an incumbent or challenger?
Which individual spent the most campaign money? How much money?
a Is this individual a Republican or Democrat?
b Is this individual an incumbent or challenger?
What is the mean or average amount of campaign expenditures for Democrats?
What is the mean or average amount of campaign expenditures for Republicans?
What is the median amount of campaign expenditures for incumbents?
What is the median amount of campaign expenditures
Assignment background
Write one Python program that answers each of the questions listed below. You can also write
multiple programs, one for each of the Assignment categories ie Nationwide and District In
your output, precede the code to calculate and display your answer with a print statement that
identifies the question number and separates the response answers from that of the previous
section.
If the question asks for a quantity eg "How much money" precede the printed quantity with
a string that clarifies your answer eg "Nancy Pelosi raised: Include all relevant data in you
answers.
For this assignment, you will use the most appropriate OpenFEC dataset for the
campaign. You can download the file from OpenFEC. If you have questions about the
assignment, please post them on the course's Piazza page.
All questions below refer to the congressional campaign.
Remember, you can work with one other student on this assignment, but if you do be sure that
you work on it together, and not split the questions. If you work with another student on this,
please only submit the assignment once and state the identification of both students
Hints
If you are looking to analyze just the congressional candidates from the OpenFEC file,
note that the ID field in the All Candidates data set has an initial character that indicates
the race in which the candidate is running. A string with a leading indicates that this
is a House race. You can reduce the number of rows in your DataFrame by using the loc
operator we covered in class. For example, the following statement will exclude rows
with and a for Senate and Presidential races:
dthousedfoc dfIDI
Assignment due
Assigned: February
Due: March : PM
Which individual raised the most campaign money? How much money?
a Is this individual a Republican or Democrat?
b Is this individual an incumbent or challenger?
Which individual spent the most campaign money? How much money?
a Is this individual a Republican or Democrat?
b Is this individual an incumbent or challenger?
What is the mean or average amount of campaign expenditures for Democrats?
What is the mean or average amount of campaign expenditures for Republicans?
What is the median amount of campaign expenditures for incumbents?
What is the median amount of campaign expenditures for challengers?
Must Read from openFEC txt file
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
