Python: The Building Blocks
Python: The Building Blocks
项目类别:计算机

Hello, dear friend, you can consult us at any time if you have any questions, add  WeChat:  zz-x2580

Please review all the material from the following Lectures before completing this assessment:
Lecture 1 - Financial Analysis with Python: Downloading Stock Prices
Lecture 2 - Python: The Building Blocks
Lecture 3 - Python: Control Flow
Lecture 4 - Working with Modules
Instructions
1. Follow the instructions provided to complete and submit your assessment.
Detailed instructions can be found in the Project description slide
2. All the files required to complete this project are included in the project1.zip file
below.
3. See the slide How to use test functions if you need help using the test functions included in this
project.
4. Once you complete the project, go to the Submit your codes here slide here to submit your code.Project Description
Project 1: Combining Data from Multiple Sources
Introduction
Finance research often requires assembling a data set from different sources. In many cases, the
source data is not formatted such that it can be imported easily into Python for analysis. This
assessment helps you develop the foundational skills of data acquisition, cleaning, and merging. You
will combine stock price information distributed across many files and produce the output as a JSON
file. We ask you to write general code, such that it can adapt easily to different file formats.
Writing general code can be a daunting exercise at first. However, it is in your best interest to practice
writing functions that can adapt to different configurations. Doing so makes your code more robust,
easier to maintain, and upgradeable.
To help you, we have provided a Python scaffold. This file, called zid_project1.py contains all the
functions needed for this project. Each function has a detailed docstring describing what the function
does, the input parameters, and the object it returns.
The remainder of this document provide information on:
The data files you will receive.
Instructions to set up your development environment in PyCharm.
Detailed step-by-step instructions required to complete the assessment. Please follow these
instructions closely. Our ability to evaluate your work requires that you do so.
You should develop your code within PyCharm. Submission, however, will be through Ed. You will
only need to copy your zid_project1.py file into Ed. Unlike the code challenges you have done so
far, Ed will not provide you any feedback on your code. You can still submit multiple times before the
deadline – Only your final submission on Ed will be marked.
The Source Files
All required files are included in a zip folder with the following structure:
project1/
| project_desc.pdf
| README.txt
| TICEKRS.txt
| zid_project1.py <-- This is the only file you need to submit
|___data/
| | _prc.dat <-- Several files of this typezid_project1.py contains the functions you will use in this assessment. Some of the functions
are already written, while others you will need to write. Please see the instructions below for

more information.


README.txt contains information about how the stock data is stored in the ".dat" files. Please
use the information contained the `README.txt` file you received (there are different versions
for different students).
TICKERS.txt contains a list of tickers and their corresponding exchanges, one per line. These
tickers and exchanges may be in upper or lower case.
project_desc.pdf is a PDF version of this document.
data is a sub-folder containing all the data you will need to complete this assessment. Inside
this folder you will find many files. Each _prc.dat contains stock price data for the ticker
. Every ticker in TICKERS.txt will have a corresponding “.dat” file. However, you may
have more “.dat” files than tickers in the TICKERS.txt file. In other words, you may have more
“.dat” files than you will need (but not fewer).
Instructions
To set up your PyCharm for this assessment, please follow the following steps:
Unzip the contents of the zip file onto your computer.
Copy/move the entire project1 folder into your PyCharm toolkit project folder. Afterwards,
your toolkit folder will look like:
toolkit/ <-- Project folder
| toolkit_config.py <-- Already created
| ...
|___project1/ <-- Contents of the zipped folder
| | project_desc.pdf
| | README.txt
| | TICEKRS.txt
| | zid_project1.py
| |
| |___data/
| | | _prc.dat
Complete the user-written functions in zid_project1.py . See the step-by-step instructions in
Completing the Code Scaffold below.
After you have completed the zid_project1.py module in PyCharm, copy and paste the entire
contents of this module to ED. This is the only file you will need to submit to complete this
assessment.
Press “Submit” to submit your project. Your project will not be submitted until you do so.
Completing the Code ScaffoldAfter setting up your PyCharm development environment with the project files (see instructions
above), modify the zid_project1.py module by taking the the steps described below, in sequence.
The completed code will produce a JSON containing the combined contents of several files. You do
not need to submit this JSON file.
Step 1: Set the location of files and folders (3 marks)
Open the zid_project1.py module in PyCharm.
Set the correct expressions for the constants ROOTDIR , DATDIR , and TICPATH as described below.
Importantly, you should not include forward slashes or backslashes when defining these variables (so
no “C:\\User. . . ”, etc. . . ). Instead, you should use the appropriate methods from the os module.
The ROOTDIR variable combines the base location of the toolkit project folder (which is
already specified in your toolkit_config.py module) and the project1 package.
The DATDIR variable combines the location in ROOTDIR above and the data sub-folder. Note
that this is a different variable than the DATADIR included in your toolkit_config.py module.
The name of the DATDIR variable is a combination of “DAT” and “DIR” (not “DATA” + “DIR”), and it
points to a different location in your computer.
The TICPATH variable combines the location in ROOTDIR and the name of the file with the
tickers (“TICKERS.txt”).


留学ICU™️ 留学生辅助指导品牌
在线客服 7*24 全天为您提供咨询服务
咨询电话(全球): +86 17530857517
客服QQ:2405269519
微信咨询:zz-x2580
关于我们
微信订阅号
© 2012-2021 ABC网站 站点地图:Google Sitemap | 服务条款 | 隐私政策
提示:ABC网站所开展服务及提供的文稿基于客户所提供资料,客户可用于研究目的等方面,本机构不鼓励、不提倡任何学术欺诈行为。