diff --git a/content/posts/credit_card.html b/content/posts/credit_card.html deleted file mode 100644 index 01fe59d..0000000 --- a/content/posts/credit_card.html +++ /dev/null @@ -1,13716 +0,0 @@ -+++ -title = "Credit Card Spending Dashboards" -date = "2020-06-16" -+++ - - - - -gspread_test - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
-
In [18]:
-
-
-
import pandas as pd
-import gspread
-import matplotlib.pyplot as plt
-
- -
-
-
- -
-
-
-
In [2]:
-
-
-
gc = gspread.service_account()
-
-sh = gc.open_by_key("1_tbwz6Z9uVZMJQZTysSQJYbSg-LCRdk6u49UngChM-Y")
-worksheet = sh.worksheet("Responses Raw")
-
-dataframe = pd.DataFrame(worksheet.get_all_records())
-
- -
-
-
- -
-
-
-
In [3]:
-
-
-
dataframe["Incurring Month"] = pd.to_datetime(dataframe["Incurring Date"]).dt.strftime(
-    "%Y%m"
-)
-df_filtered = dataframe[~dataframe["Category"].isin(["Fake", "Travel"])]
-
- -
-
-
- -
-
-
-
-

Monthly Details

-
-
-
-
-
-
In [28]:
-
-
-
df_by_monthly = pd.pivot_table(
-    df_filtered,
-    index="Incurring Month",
-    columns="Category",
-    values="Amount of Money",
-    aggfunc=sum,
-)
-df_by_monthly.fillna(0)
-
- -
-
-
- -
-
- - -
- -
Out[28]:
- - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CategoryActivitiesBillsDepositDiningDisputeEntertainmentGasGroceriesLifetime activitiesShopping
Incurring Month
2019040.0222.680.000.000.00113.500.000.000.00.00
201905234.0338.580.00307.660.00178.84161.62281.920.0132.23
2019060.0143.240.00345.080.00134.17150.79343.410.0680.92
2019070.0923.230.00282.230.00161.12201.25508.380.0346.32
201908312.0416.790.00267.680.0054.55121.98364.140.0239.29
2019090.0410.510.00281.120.00221.05129.97425.750.0170.33
2019100.0550.250.00458.670.00259.90122.33259.790.00.00
2019110.0410.730.00413.830.0038.78166.49331.740.0779.81
2019120.0393.310.00318.410.0054.7588.22238.690.0901.00
2020010.0375.330.00577.320.0037.0087.90266.090.0898.55
2020020.0380.710.00314.660.000.0081.64415.990.0375.22
2020030.0421.820.00398.820.0029.9928.87833.660.053.34
2020040.0438.680.00293.780.00143.890.00828.300.055.04
2020050.0325.94550.94352.4852.470.0068.74466.270.0117.67
2020060.0179.000.00110.920.000.000.00146.489.0124.88
-
-
- -
- -
-
- -
-
-
-
In [26]:
-
-
-
df_by_monthly_plot = df_by_monthly.plot.bar(stacked=True, figsize=(16, 9))
-df_by_monthly_plot.set_ylabel("Total Amount ($)")
-plt.xticks(rotation=45);
-
- -
-
-
- -
-
- - -
- -
- - - - -
- -
- -
- -
-
- -
-
-
-
-

Travel Details

-
-
-
-
-
-
In [30]:
-
-
-
df_travel = dataframe[
-    (dataframe["Category"] == "Travel") & (dataframe["Travel Tag"] != "")
-]
-
- -
-
-
- -
-
-
-
In [31]:
-
-
-
df_travel_by_tag = pd.pivot_table(
-    df_travel,
-    index="Travel Tag",
-    columns="Travel Details",
-    values="Amount of Money",
-    aggfunc=sum,
-    margins=True,
-)
-df_travel_by_tag = (
-    df_travel_by_tag.sort_values(["All"], ascending=False)
-    .drop("All", axis=1)
-    .drop("All")
-)
-df_travel_by_tag.fillna(0)
-
- -
-
-
- -
-
- - -
- -
Out[31]:
- - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Travel DetailsAccomendationAirlineDiningGasGroceryMiscPublic TransportationRental CarShoppingTour Ticket
Travel Tag
Hawaii Trip2192.481941.98585.9081.81164.9526.0108.49324.45235.51536.54
Yellow Stone NP Trip1678.58664.00370.1151.8180.110.0114.30366.52263.64167.88
Golden Pines RV Resort135.360.000.00185.83139.606.00.00302.808.0410.00
Redwood State Park RV Camping77.990.000.00131.94141.210.00.00230.7517.610.00
Pinnacles NP Trip60.000.000.000.000.000.00.000.0010.750.00
-
-
- -
- -
-
- -
-
-
-
In [32]:
-
-
-
df_travel_by_tag_plot = df_travel_by_tag.plot.bar(stacked=True, figsize=(12, 8))
-df_travel_by_tag_plot.set_ylabel("Total Amount ($)")
-plt.xticks(rotation=45);
-
- -
-
-
- -
-
- - -
- -
- - - - -
- -
- -
- -
-
- -
-
-
-
In [ ]:
-
-
-
 
-
- -
-
-
- -
-
-
- - - - - - - -