Excel

Exports the data from this analysis to a Microsoft Excel workbook


In [54]:
import os
import settings
import pandas as pd

Set up blank Excel workbook


In [55]:
writer = pd.ExcelWriter(
    os.path.join(settings.data_dir, '2016-analysis.xlsx'),
    engine='xlsxwriter'
)

Propositions


In [56]:
props = settings.open_csv('props-2016.csv')

In [57]:
props.to_excel(writer, sheet_name="Propositions", index=False)

Committees


In [58]:
committees = settings.open_csv('committees-2016.csv')

In [59]:
committees.to_excel(writer, sheet_name="Committees", index=False)

In [60]:
committee_positions = settings.open_csv("committees-and-props-2016.csv")

In [61]:
committee_positions.to_excel(writer, sheet_name="Committee positions", index=False)

Committee filings and expenditures


In [62]:
filings = settings.open_csv("filings-2016.csv")

In [63]:
filings.to_excel(writer, sheet_name="Filings (Since 2015-01-01)", index=False)

Transfers


In [64]:
transfers = settings.open_csv("transfers-2016.csv")

In [65]:
transfers.to_excel(writer, sheet_name="Tranfers (Schedule D)", index=False)

Refunds


In [66]:
refunds = settings.open_csv("refunds-2016.csv")

In [67]:
refunds.to_excel(writer, sheet_name="Refunds (Schedule E)", index=False)

Save out


In [68]:
writer.save()