Question: Question: Objective: Given the budget.csv file, read the date into a two-level nested dictionary. Calcula... Use Python Objective: Use Python Given the budget.csv file, read

Question: Objective: Given the budget.csv file, read the date into a two-level nested dictionary. Calcula... Use Python

Objective: Use Python

Given the budget.csv file, read the date into a two-level nested dictionary. Calculate and write the mean of each row and each column to a new file named resuit.txt.

Example Dialog:

For this data:

year 1 year 2 year 3

person 1 651000 651000 651000

person 2 1100500 950100 340000

person 3 740000 780000 800000

The value of the dictionary should look like this:

{'person 1': {'year 1': 651000, 'year 2': 651000, 'year 3': 651000}, 'person 2': {'year 1': 110500, 'year 2': 950100, 'year 3':340000}, 'person 3': {'year 1': 740000, 'year 2': 780000, 'year 3': 800000 }}

The content of 'resuit.txt should be:

The average of year1 is 830500.00

The average of year2 is 793700.00

The average of year3 is 597000.00

The average of person1 is 651000.00

The average of person2 is 796800.67

The average of person3 is 773333.33

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!