In [1]:
import os
import settings
import pandas as pd
In [2]:
filings = pd.read_csv(os.path.join(settings.data_dir, "filings.csv"))
In [3]:
sched_d = pd.read_sql_table("calaccess_processed_form460scheduleditem", settings.db_connection)
In [6]:
d_items = pd.merge(filings, sched_d, how="inner", left_on="calaccess_filing_id", right_on="filing_id")
In [7]:
d_items.to_csv(os.path.join(settings.data_dir, 'transfers.csv'), index=False)
In [8]:
recent_filings = pd.read_csv(os.path.join(settings.data_dir, "filings-2016.csv"))
In [11]:
recent_d_items = pd.merge(recent_filings, sched_d, how="inner", left_on="calaccess_filing_id", right_on="filing_id")
In [12]:
recent_d_items.to_csv(os.path.join(settings.data_dir, 'transfers-2016.csv'), index=False)