Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions The Python script should follow the format of the Template.py example. Specifically, for each of the example files ( csv , text, json, and

Instructions
The Python script should follow the format of the
Template.py example. Specifically, for each
of the example files (csv, text, json, and excel) write a separate function for each file type
that, when given the file as an argument, imports the data from that file (that is, reads the file
in) and assigns it to an appropriate Python data structure (like a data frame, etc) and returns
that data structure. When you are done with the assignment, your script, when run, should
call all these functions and, as a result, import all of the example files into corresponding
Python data structures. Make sure that your function returns a data structure (such as a data
frame and NOT a print statement).
Please make sure to:
Properly document the functions
Properly assign arguments to the functions
If you are using any libraries such as pandas or numpy, make sure that when you call the
functions from these libraries you use all relevant arguments--for example, you should not
just use pd.read_csv('file.csv'), but rather all necessary arguments of that function
Avoid excessive printing
Ensure that, as the requirement states above, import each file type's content into a
corresponding Python data structure
Utilize the if =='': clause appropriately submit a proper Python script
(.py file) as your one and only answer to the assignment
Submit a proper Python script (.py file) as your one and only answer to the assignment
Document your functions and code appropriatelyOverview and Rationale
The Week 2 Assignment requires you to write a python script that contains a function to
import each of the example file types.
Practice python dictionary using the following procedure:
Create a fifth function named "dict_func" that does the following operations:
Convert all the elements in the dict values to upper case and print it
Check whether an "input_key" exists in the dictionary (print True or False)
Convert the dictionary to a list of key, value tuple pairs and return it
Function arguments should be (dictionary, input_key)
Create a dictionary named "Canada" with the following keys and a list of minimum
five respective Canadian entities as value for each key: "Indigenous groups", "National
parks", "Provinces". Do not use junk keys or values other than the stated.
Call the function as dict_func(Canada,'Indigenous groups')
Being able to write a python script is a necessary skill for this course. In your Capstone
Project you will be required to submit files that document your script.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions