Skip to content

stanfordjournalism/fdic-failed-banks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fdic-failed-banks

FDIC Failed Banks coding assignment for Public Affairs Data Journalism.

Goals

  • Learn how to use Python libraries, work with text files and download remote files
  • Apply a growing set of practical Python skills to the FDIC failed banks data

Level up on practical Python skills

The skills covered in the tutorials below are needed to complete the Failed Banks assignment. Be sure to carefully work through these before attempting the coding assignment.

Learn how to:

You may also want to work through the Python Syntax Crash Course again if you're feeling shaky on basics such as variables, conditionals, loops, etc.

Failed CA Banks python script

Please make sure to have carefully worked through the Python tutorials mentioned above before attempting this portion of the assignment.

Requirements

The goal of this assignment is to:

  • Create a CSV containing failed banks in CA based on the FDIC Failed Banks list.
  • Print the number of failed banks in CA to the shell

For this assignment, you must create a single Python script (NOT a Jupyter Notebook) to achieve the goals described above.

Additionally, you must "reformat", or convert, the Closing Date field to a standard format.

To help you get started, we've created an empty script called failed_banks_ca.py. It includes details on the required steps.

Please read the script carefully before starting to code.

Your job is to flesh out failed_banks_ca.py in all the spots where there is a TODO.

The steps are detailed in the script, but here's an overview with links to relevant documentation on each task:

  • Use Python's requests library to download and save a copy of the FDIC failed banks CSV. Make sure to name the file banklist.csv. You don't need to use the CSV module for this step. It's preferable to just use standard file writing techniques.
  • Use Python to "read" the local banklist.csv and generate a new CSV called failed_banks_ca.csv. You must use the csv module for these steps. The file must contain only failed banks in California. It should have the same header row and columns as the source data. And you must convert the Closing Date values to a date formatted as YYYY-MM-DD (e.g. 2020-01-29). You'll need to use strptime and strftime from the datetime module to perform the conversion.
  • Create a new text file called ca_failed_banks_summary.txt. Write the following simple sentence to the text file, replacing the X with the actual count of failed banks in California: There are X failed banks in CA. For example: There are 41 failed banks in CA.. The count (X) should be calculated with code "dynamically". DO NOT hard-code a number that you determined using some other strategy (e.g. opening the file in Excel). You might find it helpful to learn about string formatting for this part of the assignment.

Important notes

  • You must use standard file writing techniques and the CSV module. Do not use pandas or other third-party libraries
  • After submitting code, be sure to check the Actions tab in GitHub repository to see if there are any errors. The auto-grader will be red if there are issues, or green if all checks passed successfully.

Advice

  • We've provided you with a starter script with guidance on specific techniques. But we're throwing a lot of new skills at you with this assignment. Make sure you take the time to practice each of these skills (e.g. in JupyterLite or Codespaces) before trying to apply them in this assignment.
  • Use print statements in your script to get visibility into the code.

Submission

Once the script is complete, you must use Codespaces to stage, commit and sync your changes to your code repository.

IMPORTANT: Always make sure you stage/commit/sync your changes before leaving the Codespace, even if your work is only partially complete. Otherwise you risk losing your work.

Lastly, to officially submit, grab the URL to your personal assignment repository and submit it via Canvas.

About

FDIC Failed Banks coding assignment for Public Affairs Data Journalism.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors