270 lines
7.9 KiB
Plaintext
270 lines
7.9 KiB
Plaintext
|
|
{
|
||
|
|
"cells": [
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 1,
|
||
|
|
"id": "3bc892c3",
|
||
|
|
"metadata": {},
|
||
|
|
"outputs": [
|
||
|
|
{
|
||
|
|
"name": "stdout",
|
||
|
|
"output_type": "stream",
|
||
|
|
"text": [
|
||
|
|
"hello world\n"
|
||
|
|
]
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"source": [
|
||
|
|
"print(\"hello world\")"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "markdown",
|
||
|
|
"id": "725bdfc5",
|
||
|
|
"metadata": {},
|
||
|
|
"source": [
|
||
|
|
"This is a markdown tile. Testing. this."
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 3,
|
||
|
|
"id": "89eea5d5",
|
||
|
|
"metadata": {},
|
||
|
|
"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>OrgID</th>\n",
|
||
|
|
" <th>Organization</th>\n",
|
||
|
|
" <th>Churn Date</th>\n",
|
||
|
|
" <th>2022-01</th>\n",
|
||
|
|
" <th>2022-02</th>\n",
|
||
|
|
" <th>2022-03</th>\n",
|
||
|
|
" <th>2022-04</th>\n",
|
||
|
|
" <th>2022-05</th>\n",
|
||
|
|
" <th>2022-06</th>\n",
|
||
|
|
" <th>2022-07</th>\n",
|
||
|
|
" <th>2022-08</th>\n",
|
||
|
|
" <th>2022-09</th>\n",
|
||
|
|
" <th>2022-10</th>\n",
|
||
|
|
" <th>2022-11</th>\n",
|
||
|
|
" <th>2022-12</th>\n",
|
||
|
|
" <th>2023-01</th>\n",
|
||
|
|
" <th>2023-02</th>\n",
|
||
|
|
" <th>2023-03</th>\n",
|
||
|
|
" <th>2023-04</th>\n",
|
||
|
|
" </tr>\n",
|
||
|
|
" </thead>\n",
|
||
|
|
" <tbody>\n",
|
||
|
|
" <tr>\n",
|
||
|
|
" <th>0</th>\n",
|
||
|
|
" <td>30867753</td>\n",
|
||
|
|
" <td>Aquent</td>\n",
|
||
|
|
" <td>2023-04</td>\n",
|
||
|
|
" <td>58</td>\n",
|
||
|
|
" <td>38</td>\n",
|
||
|
|
" <td>50</td>\n",
|
||
|
|
" <td>50</td>\n",
|
||
|
|
" <td>39</td>\n",
|
||
|
|
" <td>36</td>\n",
|
||
|
|
" <td>46</td>\n",
|
||
|
|
" <td>46</td>\n",
|
||
|
|
" <td>43.0</td>\n",
|
||
|
|
" <td>27.0</td>\n",
|
||
|
|
" <td>24.0</td>\n",
|
||
|
|
" <td>26</td>\n",
|
||
|
|
" <td>22</td>\n",
|
||
|
|
" <td>8.0</td>\n",
|
||
|
|
" <td>10.0</td>\n",
|
||
|
|
" <td>2.0</td>\n",
|
||
|
|
" </tr>\n",
|
||
|
|
" <tr>\n",
|
||
|
|
" <th>1</th>\n",
|
||
|
|
" <td>33375202</td>\n",
|
||
|
|
" <td>BioLife Solutions, Inc.</td>\n",
|
||
|
|
" <td>2023-04</td>\n",
|
||
|
|
" <td>11</td>\n",
|
||
|
|
" <td>7</td>\n",
|
||
|
|
" <td>4</td>\n",
|
||
|
|
" <td>11</td>\n",
|
||
|
|
" <td>4</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" </tr>\n",
|
||
|
|
" <tr>\n",
|
||
|
|
" <th>2</th>\n",
|
||
|
|
" <td>30867495</td>\n",
|
||
|
|
" <td>ZyXel Communications Inc</td>\n",
|
||
|
|
" <td>2023-04</td>\n",
|
||
|
|
" <td>1</td>\n",
|
||
|
|
" <td>1</td>\n",
|
||
|
|
" <td>2</td>\n",
|
||
|
|
" <td>1</td>\n",
|
||
|
|
" <td>2</td>\n",
|
||
|
|
" <td>4</td>\n",
|
||
|
|
" <td>2</td>\n",
|
||
|
|
" <td>2</td>\n",
|
||
|
|
" <td>1.0</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>1.0</td>\n",
|
||
|
|
" <td>1.0</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" </tr>\n",
|
||
|
|
" <tr>\n",
|
||
|
|
" <th>3</th>\n",
|
||
|
|
" <td>32999202</td>\n",
|
||
|
|
" <td>BrightLine Eating Solutions LLC</td>\n",
|
||
|
|
" <td>2023-03</td>\n",
|
||
|
|
" <td>10,362</td>\n",
|
||
|
|
" <td>7,890</td>\n",
|
||
|
|
" <td>7,272</td>\n",
|
||
|
|
" <td>8,177</td>\n",
|
||
|
|
" <td>8,468</td>\n",
|
||
|
|
" <td>7,524</td>\n",
|
||
|
|
" <td>8,509</td>\n",
|
||
|
|
" <td>5,638</td>\n",
|
||
|
|
" <td>581.0</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" </tr>\n",
|
||
|
|
" <tr>\n",
|
||
|
|
" <th>4</th>\n",
|
||
|
|
" <td>30867752</td>\n",
|
||
|
|
" <td>Casio America Inc</td>\n",
|
||
|
|
" <td>2023-03</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>1</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" <td>NaN</td>\n",
|
||
|
|
" </tr>\n",
|
||
|
|
" </tbody>\n",
|
||
|
|
"</table>\n",
|
||
|
|
"</div>"
|
||
|
|
],
|
||
|
|
"text/plain": [
|
||
|
|
" OrgID Organization Churn Date 2022-01 2022-02 \n",
|
||
|
|
"0 30867753 Aquent 2023-04 58 38 \\\n",
|
||
|
|
"1 33375202 BioLife Solutions, Inc. 2023-04 11 7 \n",
|
||
|
|
"2 30867495 ZyXel Communications Inc 2023-04 1 1 \n",
|
||
|
|
"3 32999202 BrightLine Eating Solutions LLC 2023-03 10,362 7,890 \n",
|
||
|
|
"4 30867752 Casio America Inc 2023-03 NaN NaN \n",
|
||
|
|
"\n",
|
||
|
|
" 2022-03 2022-04 2022-05 2022-06 2022-07 2022-08 2022-09 2022-10 2022-11 \n",
|
||
|
|
"0 50 50 39 36 46 46 43.0 27.0 24.0 \\\n",
|
||
|
|
"1 4 11 4 NaN NaN NaN NaN NaN NaN \n",
|
||
|
|
"2 2 1 2 4 2 2 1.0 NaN NaN \n",
|
||
|
|
"3 7,272 8,177 8,468 7,524 8,509 5,638 581.0 NaN NaN \n",
|
||
|
|
"4 NaN NaN NaN 1 NaN NaN NaN NaN NaN \n",
|
||
|
|
"\n",
|
||
|
|
" 2022-12 2023-01 2023-02 2023-03 2023-04 \n",
|
||
|
|
"0 26 22 8.0 10.0 2.0 \n",
|
||
|
|
"1 NaN NaN NaN NaN NaN \n",
|
||
|
|
"2 NaN NaN 1.0 1.0 NaN \n",
|
||
|
|
"3 NaN NaN NaN NaN NaN \n",
|
||
|
|
"4 NaN NaN NaN NaN NaN "
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"execution_count": 3,
|
||
|
|
"metadata": {},
|
||
|
|
"output_type": "execute_result"
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"source": [
|
||
|
|
"import pandas as pd\n",
|
||
|
|
"import sketch\n",
|
||
|
|
"cd = pd.read_csv(\"/Users/normrasmussen/Downloads/churned_analysis.csv\")\n",
|
||
|
|
"cd.head()"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"cell_type": "code",
|
||
|
|
"execution_count": 4,
|
||
|
|
"id": "b7cf96bb",
|
||
|
|
"metadata": {},
|
||
|
|
"outputs": [],
|
||
|
|
"source": [
|
||
|
|
"# Replace all NaN values with 0\n",
|
||
|
|
"cd.fillna(0, inplace=True)\n",
|
||
|
|
"\n",
|
||
|
|
"# Remove all commas from strings\n",
|
||
|
|
"cd.replace(',','', regex=True, inplace=True)\n",
|
||
|
|
"\n",
|
||
|
|
"# Convert all strings after the column 'Churn Data' to integers\n",
|
||
|
|
"for col in cd.columns[4:]:\n",
|
||
|
|
" cd[col] = cd[col].astype(int)\n",
|
||
|
|
"\n",
|
||
|
|
"cd.drop(columns=['OrgID'], inplace=True)"
|
||
|
|
]
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"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.11.1"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"nbformat": 4,
|
||
|
|
"nbformat_minor": 5
|
||
|
|
}
|