{ "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": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
OrgIDOrganizationChurn Date2022-012022-022022-032022-042022-052022-062022-072022-082022-092022-102022-112022-122023-012023-022023-032023-04
030867753Aquent2023-04583850503936464643.027.024.026228.010.02.0
133375202BioLife Solutions, Inc.2023-041174114NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
230867495ZyXel Communications Inc2023-04112124221.0NaNNaNNaNNaN1.01.0NaN
332999202BrightLine Eating Solutions LLC2023-0310,3627,8907,2728,1778,4687,5248,5095,638581.0NaNNaNNaNNaNNaNNaNNaN
430867752Casio America Inc2023-03NaNNaNNaNNaNNaN1NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", "
" ], "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 }