Python Assignment代写:100% Honor Code,高分包过

The goals of this assignment are to:

  • Wrangle and visualize data
  • Gain experience with external python libraries
  • Practice reading across code

This assignment is the second part of the two-part project where we explore and visualize the relationship across data.

In the first assignment, you combined three data sets from opendata.utah.gov (https://opendata.utah.gov/) API: COVID cases, hospital characteristics, and average home prices. In this assignment, you will be visualizing this data in an interactive user interface (a GUI) that makes it easier to explore potential patterns across the data sets.

Installing modules: Like part 1, you will need to install some Python modules. Refer back to assignment 7 to see how to do this.

The A8.py file is broken into two sections:

  • Importing and modifying the dictionary
  • Making the GUI work

Read through the starter code carefully. You will need to write your own code in each section to make the code work. If you run the starter code,
you will get a blank GUI screen.

Assignment Activities

Cleaning the Dictionary
Data is often not in a format that we want for a number of reasons, like: how the data was collected, who collected it, or what decisions were made
when storing it.

For the GUI to work, you’re going to need to modify the dictionary so that there are no missing entries. Start the assignment by going to

DictBuilder.py. In the import_dict() module, we import the dictionary as an object from the file dictionary.npy. We will need to download packages
called matplotlib, pysimplegui, and numpy.

If you want to include your own dictionary, you can add this code to the bottom of A7 to produce your own npy file.
You can find your_file_path by right click the A8 folder and selecting Copy –> Absolute Path.

import numpy as np
complete_dict = {'key':'value'}
np.save('your_file_path/your_file_name.npy', complete_dict)

You are responsible for completing the dictionary_cleaner() function. In this function you will create a new dictionary that has the following:

  1. Either every county has three keys (beds, cases, housing) and where there are missing values, you add a 0 OR you remove counties that do
    not have all three keys as part of their nested object.
  2. The keys for the datasets need to be more descriptive because we will be using these in the GUI. So instead of beds, maybe you would
    change the key to Hospital Beds.
  3. Given that the change in housing prices in so large compared to COVID cases and hospital beds, if we were to chart them together, the
    housing prices would distort the scale. In order to fix this, you will need to divide the housing prices by 100.

Creating the GUI

After you have created a new dictionary, the rest of the assignment will take place in the A8.py file.

Using the Modified Dictionary

You will need to import your new dictionary that results from dictionary_cleaner().

From this dictionary, you will extract two lists:

  1. A list of the nested dictionary keys (ex. beds, hospitals, cases)
  2. A list of the outer dictionary keys (ex. Salt Lake, Uintah, Tooele)

Creating the window object

The GUI’s layout is built in the function build_window(). This function takes two parameters (the lists you created above) and a third optional one,
a string with the name of a color theme. The default is TealMono, but you can choose your own theme and pass it into the function.

In the WHILE loop

Your GUI runs in a WHILE loop. Within this loop three things happen:

  1. You check for events
  2. You collect user inputs
  3. You draw a bar chart based on inputs

You will see in the WHILE loop, we are already checking for one event: whether the user clicks the Exit button.

if event == 'Exit':
 break

In this event, the IF statement is checking whether the button that is associated with the string ‘Exit’ has been pressed. In GUIBuilder.py, we define
the button and the associated string here:

sg.Button('Exit')

You are responsible for creating another event listener for the button plot. We want the bar chart to draw only if the user has selected all four
options AND has clicked the Plot button. You will need to combine both an event listener and if statement that checks for Truthy values. If all those
conditions are true, then you will pass the choices to the barchart() method and draw it.

contact

Assignment Exmaple

Recent Case

Service Scope

C|C++|Java|Python|Matlab|Android|Jsp|Prolo
g|MIPS|Haskell|R|Linux|C#|PHP|SQL|.Net|Hand
oop|Processing|JS|Ruby|Scala|Rust|Data Mining|数据库|Oracle|Mysql|Sqlite|IOS|Data Mining|网络编程|多线程编程|Linux编程操作系统|计算机网络|留学生|编程|程序|代写|加急|个人代写|作业代写|Assignment

Wechat:maxxuezhang

wechat