Skip to content

Latest commit

 

History

History
52 lines (31 loc) · 3.27 KB

File metadata and controls

52 lines (31 loc) · 3.27 KB

Assignment 1

Python reading and reps

Read and work through the following chapters in Automate the Boring Stuff.

NOTE: You don't have to do the exercises, but you should type in the commands for code examples throughout the text.

Additionally, you should not follow the book's suggestion on installing Python. If you have kept pace with technical installations in class, you should be set up with the appropriate version of Python so there is no need to install anything else.

To follow code examples in the text, just type python in a shell terminal to fire up an interactive Python interpreter.

If you have not yet installed Python 3.5 or later for class, please reach out via Slack to discuss options.

Failed CA Banks shell script

Create an automated shell script that performs the following tasks using the FDIC’s failed banks list:

  • Download the CSV of failed banks using curl or wget
  • Generate a new CSV called failed_banks_ca.csv that contains only failed banks in California. This file must contain the same header row as the source data.
  • Print a count of failed banks in California to the shell. You must print the following text: There are X failed banks in CA, replacing the X with the correct count. For example: There are 1824 failed banks in CA. The count (X) should be generated dynamically. In other words, the value of X should be replaced using code; do not hard-code the count directly in the text. HINT: You can use a technique called command substitution to calculate the value and store it in a variable for use in downstream echo commands (see csvkit_wrangle.sh for an example of using variables in text).

The shell commands used to produce the CSV and count of banks must be stored in a single shell script called failed_banks_ca.sh.

See here for details on the workflow required to create the script.

Your are free to use standard shell commands and/or csvkit utilities on this assignment.

To submit the assignment, you must create a new code project using DataKit and save the script in the project's scripts/ directory.

Here's how to create the new project folder:

datakit project create
# When prompted:
#  - Choose "1 - Assignment" as the "repo_type" 
#  - Type "1" for the "project_number_or_shortname".

For more details on how to work with DataKit, see here.

NOTE: Grading for this assignment will be based both on the script itself as well as your attention to detail. For example, points will be deducted if the script is not named correctly and placed in the proper folder of the project.