This repository was archived by the owner on Oct 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·36 lines (27 loc) · 1.49 KB
/
test.py
File metadata and controls
executable file
·36 lines (27 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
from os import path
from os import listdir
from os.path import isfile, join
import pandas as pd
import psycopg2
import requests as re
from census_functions import CensusTools
Censustool = CensusTools()
#Censustool.config_data["ALL_YEARS"] = 2018
#download census files
Censustool.get_ffiec_census_file(years=Censustool.config_data["ALL_YEARS"], download=True, unzip=False, move=False)
#Unzip Census files
#Censustool.get_ffiec_census_file(years=Censustool.config_data["ALL_YEARS"], download=False, unzip=True, move=False)
#2017 is zipped twice, the second call unzips the sub archive
#Censustool.get_ffiec_census_file(years=["2017"], download=False, unzip=True, move=False)
#move Census files and empty folders
#Censustool.get_ffiec_census_file(years=Censustool.config_data["ALL_YEARS"], download=False, unzip=False, move=True)
#extract desired columns from census files
#extracts_dict = Censustool.extract_census_fields(years=Censustool.config_data["ALL_YEARS"]) #sep can be changed to comma for CSV output
#download OMB MSA MD delineation files
Censustool.get_census_omb_delineation_file(years=Censustool.config_data["ALL_YEARS"])
#combine OMB and FFIEC census data and create MSA/MD name description files
census_df_dict = Censustool.combine_omb_ffiec(years=Censustool.config_data["ALL_YEARS"], sep=",")
census_df_dict = Censustool.combine_omb_ffiec(years=Censustool.config_data["ALL_YEARS"], sep="|")
#load combined data to database
#Censustool.load_to_db(years=Censustool.config_data["ALL_YEARS"])