{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e44d957a-20cc-412e-af65-e1c484df9e56",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "# Setup and initialization\n",
    "import json\n",
    "import pandas as pd\n",
    "import plotly.express as px\n",
    "import plotly.graph_objects as go\n",
    "import numpy as np\n",
    "from io import StringIO\n",
    "from datetime import datetime\n",
    "\n",
    "# Load CSV file into a raw dataframe\n",
    "df = pd.read_csv('churn.csv')\n",
    "\n",
    "# Pull some quick stats\n",
    "category_totals = df.groupby('category').size()\n",
    "\n",
    "user_category_labels = {\n",
    "    'quick-exit': 'Free trial churn',\n",
    "    'fair-trial': 'D74 churn',\n",
    "    'short-termer': '6 month churn',\n",
    "    'long-termer': '> 6 months active'\n",
    "}\n",
    "metric_timeframe_labels = {\n",
    "    'short term': 'During free trial',\n",
    "    'medium term': 'After trial, before 90 days',\n",
    "    'long term': 'After 90 days, first 6 months'\n",
    "}\n",
    "\n",
    "category_order = {\n",
    "    'category': list(user_category_labels.keys())\n",
    "}\n",
    "\n",
    "def metric_label(metric_key):\n",
    "    parts = metric_key.split('_')\n",
    "    if \"term\" in parts:\n",
    "        timeframe = metric_timeframe_labels[\" \".join(parts[-2:])]\n",
    "        name = \" \".join(parts[0:-2]).title()\n",
    "    else:\n",
    "        timeframe = 'Lifetime'\n",
    "        name = parts.join(\" \").title()\n",
    "    return f\"{name}: {timeframe}\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "3e1b4524-f47d-410c-ac49-d1cc6a745ee6",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "def dffromstring(s):\n",
    "    return pd.read_csv(StringIO(s))\n",
    "df_db_medium = dffromstring(\"\"\"category,total,both_multiple,one_multiple,both_single,one_single,none\n",
    "01: Free trial churn,1363,0,5,1,24,75\n",
    "02: D74 churn,1028,0,12,6,32,67\n",
    "03: 6-month churn,1779,0,10,5,27,72\n",
    "04: > 6 months active,269,1,11,4,28,71\n",
    "\"\"\")\n",
    "df_db_medium_bookings = dffromstring(\"\"\"category,total,both_multiple_no_call,both_multiple_with_call,one_multiple_no_call,one_multiple_with_call,both_no_call,both_with_call,one_no_call,one_with_call,none_no_call,none_with_call\n",
    "01: Free trial churn,1363,0,0,4,3,1,0,23,22,65,9\n",
    "02: D74 churn,1028,0,0,10,8,3,2,31,29,57,9\n",
    "03: 6-month churn,1779,0,0,8,7,3,2,26,23,66,6\n",
    "04: > 6 months active,269,0,0,9,6,2,2,27,25,66,5\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "62640aef-00d2-43b1-af1a-a28db7343321",
   "metadata": {},
   "source": [
    "## % of users who created booking forms and/or checklists before 90 days\n",
    "We group users created after 2023-01-01 by when they churned, then look at what they created in their first 90 days. While the difference isn't huge, usage is noticeably higher in the d74 churn group"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d334b79f-f4f0-45fd-98e6-d5d87c040526",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>category</th>\n",
       "      <th>Multiple of both</th>\n",
       "      <th>Multiple of at least one</th>\n",
       "      <th>One of both</th>\n",
       "      <th>One of at least one</th>\n",
       "      <th>Neither</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>01: Free trial churn</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "      <td>24</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>02: D74 churn</td>\n",
       "      <td>0</td>\n",
       "      <td>12</td>\n",
       "      <td>6</td>\n",
       "      <td>32</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>03: 6-month churn</td>\n",
       "      <td>0</td>\n",
       "      <td>10</td>\n",
       "      <td>5</td>\n",
       "      <td>27</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>04: &gt; 6 months active</td>\n",
       "      <td>1</td>\n",
       "      <td>11</td>\n",
       "      <td>4</td>\n",
       "      <td>28</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                category  Multiple of both  Multiple of at least one  \\\n",
       "0   01: Free trial churn                 0                         5   \n",
       "1          02: D74 churn                 0                        12   \n",
       "2      03: 6-month churn                 0                        10   \n",
       "3  04: > 6 months active                 1                        11   \n",
       "\n",
       "   One of both  One of at least one  Neither  \n",
       "0            1                   24       75  \n",
       "1            6                   32       67  \n",
       "2            5                   27       72  \n",
       "3            4                   28       71  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "summary_df = df_db_medium[['category']].copy()\n",
    "summary_df['Multiple of both'] = df_db_medium['both_multiple']\n",
    "summary_df['Multiple of at least one'] = df_db_medium['one_multiple']\n",
    "summary_df['One of both'] = df_db_medium['both_single']\n",
    "summary_df['One of at least one'] = df_db_medium['one_single']\n",
    "summary_df['Neither'] = df_db_medium['none']\n",
    "summary_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "06c7fabf-99dd-4f15-83c2-0f92b3e0be68",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "# Weekly data processing\n",
    "max_weeks = 12\n",
    "\n",
    "def weekly_averages(metric, created_after=None):\n",
    "    records = []\n",
    "    metric_col = f\"{metric}_weekly_counts\"\n",
    "    \n",
    "    for category in df['category'].unique():\n",
    "        cat_df = df[df['category'] == category].copy()\n",
    "\n",
    "        if created_after is not None:\n",
    "            cat_df['created_at'] = pd.to_datetime(cat_df['created_at'])\n",
    "            cat_df = cat_df[cat_df['created_at'] >= pd.to_datetime(created_after)]\n",
    "        \n",
    "        num_users = len(cat_df)\n",
    "        \n",
    "        cat_df = cat_df.copy()\n",
    "        cat_df['end_week'] = (cat_df['lifespan'] / 7).apply(np.floor).astype(int)\n",
    "        \n",
    "        cumulative_per_week = [0.0] * max_weeks\n",
    "        \n",
    "        for idx, row in cat_df.iterrows():\n",
    "            end_week = row['end_week']\n",
    "            \n",
    "            # Parse this user's weekly counts\n",
    "            user_weekly = [0] * max_weeks\n",
    "            value = row[metric_col]\n",
    "            if pd.notna(value) and value != '{}':\n",
    "                try:\n",
    "                    counts_dict = json.loads(value)\n",
    "                    for key, count in counts_dict.items():\n",
    "                        week_num = int(key.replace('week_', ''))\n",
    "                        if week_num < max_weeks:\n",
    "                            user_weekly[week_num] = count\n",
    "                except (json.JSONDecodeError, ValueError):\n",
    "                    pass\n",
    "            \n",
    "            # Calculate this user's cumulative usage\n",
    "            user_cumulative = np.cumsum(user_weekly)\n",
    "            \n",
    "            # Extend their final value to the end of the range\n",
    "            last_value = user_cumulative[min(end_week, max_weeks - 1)]\n",
    "            for week in range(max_weeks):\n",
    "                if week <= end_week:\n",
    "                    cumulative_per_week[week] += user_cumulative[week]\n",
    "                else:\n",
    "                    cumulative_per_week[week] += last_value\n",
    "        \n",
    "        # Calculate averages over all users\n",
    "        for week in range(max_weeks):\n",
    "            records.append({\n",
    "                'category': user_category_labels[category],\n",
    "                'week': week,\n",
    "                'cumulative_avg': cumulative_per_week[week] / num_users if num_users > 0 else 0\n",
    "            })\n",
    "    \n",
    "    return records\n",
    "\n",
    "# Weekly averages line chart renderer\n",
    "def weekly_averages_chart(metric_name, title, created_after=None):\n",
    "    chart_data = pd.DataFrame(weekly_averages(metric_name, created_after))\n",
    "    \n",
    "    # Plot\n",
    "    line_chart = px.line(\n",
    "        chart_data,\n",
    "        x='week',\n",
    "        y='cumulative_avg',\n",
    "        color='category',\n",
    "        title=title,\n",
    "        category_orders=category_order,\n",
    "        labels={'week': 'Week', 'cumulative_avg': 'Average Created', 'category': 'User Group'},\n",
    "        markers=True\n",
    "    )\n",
    "    line_chart.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3fe8b6d9-c755-4689-966d-8d1709170172",
   "metadata": {},
   "source": [
    "## Avg. number of booking forms created by week\n",
    "Here we see where booking forms are created over time. The churn groups create more earlier, while the active group ramps up to usage more slowly."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "b6669a80-b631-40a7-8c37-865a67a5712b",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "hovertemplate": "User Group=D74 churn<br>Week=%{x}<br>Average Created=%{y}<extra></extra>",
         "legendgroup": "D74 churn",
         "line": {
          "color": "#FFA15A",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines+markers",
         "name": "D74 churn",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": {
          "bdata": "AAECAwQFBgcICQoL",
          "dtype": "i1"
         },
         "xaxis": "x",
         "y": {
          "bdata": "Gn5L09Ub0j+dVetup23UP19BuzyQltU/bcKtHMQx1j/GFnYY+rHWPy9wyuD159Y/IGs+FDAy1z8urn3qrFrXP2p8xznpidc/H6nxHeek1z9MNPyWpqvXP0w0/Jamq9c/",
          "dtype": "f8"
         },
         "yaxis": "y"
        },
        {
         "hovertemplate": "User Group=Free trial churn<br>Week=%{x}<br>Average Created=%{y}<extra></extra>",
         "legendgroup": "Free trial churn",
         "line": {
          "color": "#19d3f3",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines+markers",
         "name": "Free trial churn",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": {
          "bdata": "AAECAwQFBgcICQoL",
          "dtype": "i1"
         },
         "xaxis": "x",
         "y": {
          "bdata": "ldlpOtcHzD/dgjtJ2iDNP6t8SsrsNM0/q3xKyuw0zT+rfErK7DTNP6t8SsrsNM0/q3xKyuw0zT+rfErK7DTNP6t8SsrsNM0/q3xKyuw0zT+rfErK7DTNP6t8SsrsNM0/",
          "dtype": "f8"
         },
         "yaxis": "y"
        },
        {
         "hovertemplate": "User Group=6 month churn<br>Week=%{x}<br>Average Created=%{y}<extra></extra>",
         "legendgroup": "6 month churn",
         "line": {
          "color": "#FF6692",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines+markers",
         "name": "6 month churn",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": {
          "bdata": "AAECAwQFBgcICQoL",
          "dtype": "i1"
         },
         "xaxis": "x",
         "y": {
          "bdata": "j6ERnpmg0D9iQ4y1YHzTP1uZNxdeYtU/0y3H/hV01j/HcsmMh1PXP1yO/SvorNc/8Kkxy0gG2D+xij+Ia3DYP3JrTUWO2tg/eQpo+Bo/2T8663W1PanZP746Aw+E29k/",
          "dtype": "f8"
         },
         "yaxis": "y"
        },
        {
         "hovertemplate": "User Group=> 6 months active<br>Week=%{x}<br>Average Created=%{y}<extra></extra>",
         "legendgroup": "> 6 months active",
         "line": {
          "color": "#B6E880",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines+markers",
         "name": "> 6 months active",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": {
          "bdata": "AAECAwQFBgcICQoL",
          "dtype": "i1"
         },
         "xaxis": "x",
         "y": {
          "bdata": "l1UGz+Qvyj+/wzXE2jjQP7hz62x3E9I/Mi49FCWQ0z+toHCfuL3UP6qLOKKWedU/qBt12soX1j+lPbmZxcnWP6LN9dH5Z9c/ILDsJFn31z8eHBpPAG7YP5w1jV5889g/",
          "dtype": "f8"
         },
         "yaxis": "y"
        }
       ],
       "layout": {
        "legend": {
         "title": {
          "text": "User Group"
         },
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermap": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermap"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "Week"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "Average Created"
         }
        }
       }
      },
      "image/png": "[encoded data, 83620 characters]"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "weekly_averages_chart('booking_forms', '')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bebb5757-fd87-477d-b542-17732990b907",
   "metadata": {},
   "source": [
    "## Avg. number of checklists created by week\n",
    "The same story is repeated for checklists, with the active group not moving as fast as the churners."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "b3d0e404-7c62-4330-b106-fb6bf32a89de",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "hovertemplate": "User Group=D74 churn<br>Week=%{x}<br>Average Created=%{y}<extra></extra>",
         "legendgroup": "D74 churn",
         "line": {
          "color": "#FFA15A",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines+markers",
         "name": "D74 churn",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": {
          "bdata": "AAECAwQFBgcICQoL",
          "dtype": "i1"
         },
         "xaxis": "x",
         "y": {
          "bdata": "Jlg7Jw5B9j8B24JHIBIBQC/lM5nxdQNAQpHRrHiWBkAAtynon6QHQA1mMwdFRgtAnu4JaHu5C0CxvyQ04scNQMdpepWq5w1APLm6cHYFDkCmM1AbXhMOQPS9JVg7Jw5A",
          "dtype": "f8"
         },
         "yaxis": "y"
        },
        {
         "hovertemplate": "User Group=Free trial churn<br>Week=%{x}<br>Average Created=%{y}<extra></extra>",
         "legendgroup": "Free trial churn",
         "line": {
          "color": "#19d3f3",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines+markers",
         "name": "Free trial churn",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": {
          "bdata": "AAECAwQFBgcICQoL",
          "dtype": "i1"
         },
         "xaxis": "x",
         "y": {
          "bdata": "PKDRDPJS7D8YQLqeLSHwPxhAup4tIfA/GEC6ni0h8D8YQLqeLSHwPxhAup4tIfA/GEC6ni0h8D8YQLqeLSHwPxhAup4tIfA/GEC6ni0h8D8YQLqeLSHwPxhAup4tIfA/",
          "dtype": "f8"
         },
         "yaxis": "y"
        },
        {
         "hovertemplate": "User Group=6 month churn<br>Week=%{x}<br>Average Created=%{y}<extra></extra>",
         "legendgroup": "6 month churn",
         "line": {
          "color": "#FF6692",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines+markers",
         "name": "6 month churn",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": {
          "bdata": "AAECAwQFBgcICQoL",
          "dtype": "i1"
         },
         "xaxis": "x",
         "y": {
          "bdata": "eTj4ld/w+D+CPBz8ym8AQLFS4q3ZqQVAyTtxzteGCECYJCJDDm0LQFJZ1B7K1QxAtcsapm+JDkBVweJ6W9UPQB+5q9gg3BBAxtNickaHEUAAzYEr8l8SQGbJKkcy0xJA",
          "dtype": "f8"
         },
         "yaxis": "y"
        },
        {
         "hovertemplate": "User Group=> 6 months active<br>Week=%{x}<br>Average Created=%{y}<extra></extra>",
         "legendgroup": "> 6 months active",
         "line": {
          "color": "#B6E880",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines+markers",
         "name": "> 6 months active",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": {
          "bdata": "AAECAwQFBgcICQoL",
          "dtype": "i1"
         },
         "xaxis": "x",
         "y": {
          "bdata": "bbLJJpts8D+yySabbLLxP3TRRRdddP0/ZZNNNtlkD0CyySabbLIQQLrooosuOhJAAAAAAAAAE0B88MEHH3wUQD744IMPvhVAAAAAAACAG0B88MEHH/wcQCebbLLJ5iNA",
          "dtype": "f8"
         },
         "yaxis": "y"
        }
       ],
       "layout": {
        "legend": {
         "title": {
          "text": "User Group"
         },
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermap": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermap"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "Week"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "Average Created"
         }
        }
       }
      },
      "image/png": "[encoded data, 77888 characters]"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "weekly_averages_chart('checklists', '', created_after='2025-01-01')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f58ae8c5-e046-4a0f-8e96-9b9f75a1e377",
   "metadata": {},
   "source": [
    "## % of users creating bookings or checklists by scheduled onboarding calls\n",
    "At a glance, for these metrics, it doesn't look like having an onboarding call impacts usage. Note that this goes by the presence of a \"booked_demo_call_at\" field in the database - we don't have a way to tell if the call actually took place."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "61b302b5-da6c-4305-b70e-7965f7fee0e2",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>category</th>\n",
       "      <th>Created both with no call</th>\n",
       "      <th>Created both with a call</th>\n",
       "      <th>Created one with no call</th>\n",
       "      <th>Created one with a call</th>\n",
       "      <th>None with no call</th>\n",
       "      <th>None with a call</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>01: Free trial churn</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>23</td>\n",
       "      <td>22</td>\n",
       "      <td>65</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>02: D74 churn</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>31</td>\n",
       "      <td>29</td>\n",
       "      <td>57</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>03: 6-month churn</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>26</td>\n",
       "      <td>23</td>\n",
       "      <td>66</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>04: &gt; 6 months active</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>27</td>\n",
       "      <td>25</td>\n",
       "      <td>66</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                category  Created both with no call  Created both with a call  \\\n",
       "0   01: Free trial churn                          1                         0   \n",
       "1          02: D74 churn                          3                         2   \n",
       "2      03: 6-month churn                          3                         2   \n",
       "3  04: > 6 months active                          2                         2   \n",
       "\n",
       "   Created one with no call  Created one with a call  None with no call  \\\n",
       "0                        23                       22                 65   \n",
       "1                        31                       29                 57   \n",
       "2                        26                       23                 66   \n",
       "3                        27                       25                 66   \n",
       "\n",
       "   None with a call  \n",
       "0                 9  \n",
       "1                 9  \n",
       "2                 6  \n",
       "3                 5  "
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "summary_df = df_db_medium_bookings[['category']].copy()\n",
    "summary_df['Created both with no call'] = df_db_medium_bookings['both_no_call']\n",
    "summary_df['Created both with a call'] = df_db_medium_bookings['both_with_call']\n",
    "summary_df['Created one with no call'] = df_db_medium_bookings['one_no_call']\n",
    "summary_df['Created one with a call'] = df_db_medium_bookings['one_with_call']\n",
    "summary_df['None with no call'] = df_db_medium_bookings['none_no_call']\n",
    "summary_df['None with a call'] = df_db_medium_bookings['none_with_call']\n",
    "summary_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "232e89d8-286b-46ea-8a68-e5afea0e0e33",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
