Financial Analysis


In [1]:
%matplotlib inline

In [14]:
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd 

sns.set_style('darkgrid')
sns.set_context('poster')

In [10]:
df = pd.read_csv('../fixtures/accounts.csv')
df['Month'] = pd.to_datetime(df['Month'])

In [23]:
df[df['Account Type'] == 'Loans']


Out[23]:
Month Account Type Bank Account Name Beginning Balance Ending Balance
14 2012-04-03 Loans Nationstar Mortgage -589515.71 -588687.36
15 2012-04-03 Loans USAA My Auto Loan -13196.71 -12633.75
16 2012-04-03 Loans ACS Consolidation Loan -6461.17 -6277.36
17 2012-04-03 Loans ACS Federal Stafford Loan -1690.61 -1528.94
32 2012-05-01 Loans Nationstar Mortgage -588687.36 -587855.84
33 2012-05-01 Loans USAA My Auto Loan -12657.92 -12094.96
34 2012-05-01 Loans ACS Consolidation Loan -11660.88 -11477.06
35 2012-05-01 Loans ACS Federal Stafford Loan -1532.11 -1370.46
50 2012-06-05 Loans Nationstar Mortgage -590417.22 -587021.84
51 2012-06-05 Loans USAA My Auto Loan -12123.89 -11560.93
52 2012-06-05 Loans ACS Consolidation Loan 0.00 0.00
53 2012-06-05 Loans ACS Federal Stafford Loan 0.00 0.00
69 2012-07-05 Loans Nationstar Mortgage 585000.00 -585000.00
70 2012-07-05 Loans USAA My Auto Loan -11584.57 -11021.61
71 2012-07-05 Loans ACS Consolidation Loan -1214.67 -1053.01
72 2012-07-05 Loans ACS Federal Stafford Loan -5973.06 -5789.25
87 2012-08-06 Loans Wells Fargo Mortgage -594763.17 -591544.68
88 2012-08-06 Loans USAA My Auto Loan -11045.62 -10482.66
89 2012-08-06 Loans ACS Consolidation Loan -1055.36 -893.71
90 2012-08-06 Loans ACS Federal Stafford Loan -5808.86 -5625.06
105 2012-09-04 Loans Nationstar Mortgage -591554.68 -588336.21
106 2012-09-04 Loans USAA My Auto Loan -10501.18 -9938.21
107 2012-09-04 Loans ACS Consolidation Loan -895.91 -734.26
108 2012-09-04 Loans ACS Federal Stafford Loan -5645.41 -5461.59
123 2012-10-03 Loans Nationstar Mortgage -590659.58 -587441.11
124 2012-10-03 Loans USAA My Auto Loan -9958.66 -9395.69
125 2012-10-03 Loans ACS Consolidation Loan 0.00 0.00
126 2012-10-03 Loans ACS Federal Stafford Loan 0.00 0.00
141 2012-11-05 Loans Nationstar Mortgage -589761.68 -586543.21
142 2012-11-05 Loans USAA My Auto Loan -9416.31 -8853.34
... ... ... ... ... ... ...
755 2015-05-01 Loans ACS Federal Stafford Loan 0.00 0.00
756 2015-05-01 Loans USAA Home Fixup Loan -2229.11 -2102.42
773 2015-06-01 Loans Nationstar Mortgage -566521.66 -563557.14
774 2015-06-01 Loans ACS Consolidation Loan -1217.86 -1034.03
775 2015-06-01 Loans ACS Federal Stafford Loan 0.00 0.00
776 2015-06-01 Loans USAA Home Fixup Loan -2121.69 -1995.00
793 2015-07-02 Loans Nationstar Mortgage -565569.91 -562605.39
794 2015-07-02 Loans ACS Consolidation Loan -1036.44 -852.62
795 2015-07-02 Loans ACS Federal Stafford Loan 0.00 0.00
796 2015-07-02 Loans USAA Home Fixup Loan -2011.02 -1884.33
813 2015-08-04 Loans Nationstar Mortgage -564615.57 -561651.06
814 2015-08-04 Loans ACS Consolidation Loan -856.48 -672.66
815 2015-08-04 Loans ACS Federal Stafford Loan 0.00 0.00
816 2015-08-04 Loans USAA Home Fixup Loan -1901.59 -1774.91
833 2015-09-03 Loans Nationstar Mortgage -563658.67 -560694.16
834 2015-09-03 Loans ACS Consolidation Loan -672.12 -488.31
835 2015-09-03 Loans ACS Federal Stafford Loan 0.00 0.00
836 2015-09-03 Loans USAA Home Fixup Loan -1789.66 -1662.96
853 2015-10-02 Loans Nationstar Mortgage -562699.17 -559734.66
854 2015-10-02 Loans ACS Consolidation Loan -489.47 -305.66
855 2015-10-02 Loans ACS Federal Stafford Loan 0.00 0.00
856 2015-10-02 Loans USAA Home Fixup Loan -1676.34 -1549.66
873 2015-11-01 Loans Nationstar Mortgage -561737.06 -558772.54
874 2015-11-01 Loans ACS Consolidation Loan -307.19 0.00
875 2015-11-01 Loans ACS Federal Stafford Loan 0.00 0.00
876 2015-11-01 Loans USAA Home Fixup Loan -1562.63 -1435.94
893 2015-12-02 Loans Nationstar Mortgage -560772.36 -557807.83
894 2015-12-02 Loans ACS Consolidation Loan 0.00 0.00
895 2015-12-02 Loans ACS Federal Stafford Loan 0.00 0.00
896 2015-12-02 Loans USAA Home Fixup Loan -1448.39 -1321.71

208 rows × 6 columns


In [26]:
atypes = df['Account Type'].unique()
data = df[df['Account Type'] == atypes[1]]
sns.tsplot(time="Month", value="Beginning Balance", unit="Account Type", condition="Account Name",data=data)


Out[26]:
<matplotlib.axes._subplots.AxesSubplot at 0x108e64e90>

In [32]:
anames = df['Account Name'].unique()
for idx, name in enumerate(anames): print "{}: {}".format(idx, name)
data = df[df['Account Name'] == anames[20]]
sns.tsplot(time="Month", value="Beginning Balance", unit="Account Type", condition="Account Name",data=data)


0: EveryDay Checking
1: Share Savings
2: Four Star Checking
3: Performance First Savings
4: Bank Account
5: TNS Simple IRA
6: Balanced Long Term MF
7: Roth IRA
8: 401k
9: World Mastercard
10: Discover Card
11: United Visa
12: Amazon Visa
13: nRewards Visa
14: Mortgage
15: My Auto Loan
16: Consolidation Loan
17: Federal Stafford Loan
18: Tactical ETF
19: Home Fixup Loan
20: Exchange Tactical Fund
21: Youth Savings
22: CB&T Roth IRA
23: Google Wallet
Out[32]:
<matplotlib.axes._subplots.AxesSubplot at 0x107644910>