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 1Assignment 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 (i.e., 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 (e.g., "How much money") precede the printed quantity with
a string that clarifies your answer (e.g., "Nancy Pelosi raised: "). Include all relevant data in your
answers.
For this assignment, you will use the most appropriate OpenFEC dataset for the 2023-2024
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 'H' 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 'S' and a 'P'(for Senate and Presidential races):
dfhouse=df1.loc[df1['ID']'I']
Assignment due
Assigned: February 28
Due: March 5,11:59 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 (i.e., 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 (e.g., "How much money") precede the printed quantity with
a string that clarifies your answer (e.g., "Nancy Pelosi raised: "). Include all relevant data in you
answers.
For this assignment, you will use the most appropriate OpenFEC dataset for the 2023-2024
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 'H' 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'S' and a 'P'(for Senate and Presidential races):
dthouse=df1.1oc [df1['ID']'I']
Assignment due
Assigned: February 28
Due: March 5,11:59 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
 Assignment 1Assignment background Write one Python program that answers each of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!