aboutsummaryrefslogtreecommitdiff
path: root/CS105MiniProject.ipynb
diff options
context:
space:
mode:
authorGravatar Anshul Gupta <ansg191@anshulg.com> 2024-02-15 16:27:13 -0800
committerGravatar Anshul Gupta <ansg191@anshulg.com> 2024-02-15 16:28:42 -0800
commitfb338fc4f022ce2ea76d72ce0856fbc74fb79f79 (patch)
treeaf6c95b0cda0060a25adf80df07c54e7556061cd /CS105MiniProject.ipynb
parent16282101f71bd991b3b14159e0235cacf1cf03dc (diff)
downloadCS105MiniProject-fb338fc4f022ce2ea76d72ce0856fbc74fb79f79.tar.gz
CS105MiniProject-fb338fc4f022ce2ea76d72ce0856fbc74fb79f79.tar.zst
CS105MiniProject-fb338fc4f022ce2ea76d72ce0856fbc74fb79f79.zip
Changes name to data.csv
Diffstat (limited to 'CS105MiniProject.ipynb')
-rw-r--r--CS105MiniProject.ipynb488
1 files changed, 71 insertions, 417 deletions
diff --git a/CS105MiniProject.ipynb b/CS105MiniProject.ipynb
index 495a644..4935969 100644
--- a/CS105MiniProject.ipynb
+++ b/CS105MiniProject.ipynb
@@ -1,422 +1,76 @@
{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "daa13044",
- "metadata": {
- "id": "daa13044",
- "outputId": "4d440aaa-1ee7-4771-c526-f55e9458ca8a",
- "colab": {
- "base_uri": "https://localhost:8080/",
- "height": 614
- }
- },
- "outputs": [
- {
- "output_type": "execute_result",
- "data": {
- "text/plain": [
- " Timestamp What gender do you identify as? \\\n",
- "0 2/9/2024 20:12:14 Male \n",
- "1 2/9/2024 20:16:34 Female \n",
- "2 2/9/2024 20:18:55 Female \n",
- "3 2/9/2024 20:24:00 Male \n",
- "4 2/9/2024 20:26:16 Male \n",
- ".. ... ... \n",
- "255 2/14/2024 19:46:28 Male \n",
- "256 2/15/2024 0:28:38 Male \n",
- "257 2/15/2024 8:33:45 Male \n",
- "258 2/15/2024 16:10:40 Female \n",
- "259 2/15/2024 16:14:11 Female \n",
- "\n",
- " Who do you live with? How many people live in your household? \n",
- "0 Neither 6 \n",
- "1 Both 4 \n",
- "2 Friends 4 \n",
- "3 Neither 1 \n",
- "4 Neither 1 \n",
- ".. ... ... \n",
- "255 Friends 5 \n",
- "256 Family North District 4 bed 2 bath \n",
- "257 Family 9 \n",
- "258 Family 4 \n",
- "259 Friends 3 (room), 8 (hall), ~70 (building) \n",
- "\n",
- "[260 rows x 4 columns]"
- ],
- "text/html": [
- "\n",
- " <div id=\"df-a860243d-1475-4912-ac7f-83183a2056d2\" class=\"colab-df-container\">\n",
- " <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>Timestamp</th>\n",
- " <th>What gender do you identify as?</th>\n",
- " <th>Who do you live with?</th>\n",
- " <th>How many people live in your household?</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>0</th>\n",
- " <td>2/9/2024 20:12:14</td>\n",
- " <td>Male</td>\n",
- " <td>Neither</td>\n",
- " <td>6</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1</th>\n",
- " <td>2/9/2024 20:16:34</td>\n",
- " <td>Female</td>\n",
- " <td>Both</td>\n",
- " <td>4</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2</th>\n",
- " <td>2/9/2024 20:18:55</td>\n",
- " <td>Female</td>\n",
- " <td>Friends</td>\n",
- " <td>4</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>3</th>\n",
- " <td>2/9/2024 20:24:00</td>\n",
- " <td>Male</td>\n",
- " <td>Neither</td>\n",
- " <td>1</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>4</th>\n",
- " <td>2/9/2024 20:26:16</td>\n",
- " <td>Male</td>\n",
- " <td>Neither</td>\n",
- " <td>1</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>...</th>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>255</th>\n",
- " <td>2/14/2024 19:46:28</td>\n",
- " <td>Male</td>\n",
- " <td>Friends</td>\n",
- " <td>5</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>256</th>\n",
- " <td>2/15/2024 0:28:38</td>\n",
- " <td>Male</td>\n",
- " <td>Family</td>\n",
- " <td>North District 4 bed 2 bath</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>257</th>\n",
- " <td>2/15/2024 8:33:45</td>\n",
- " <td>Male</td>\n",
- " <td>Family</td>\n",
- " <td>9</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>258</th>\n",
- " <td>2/15/2024 16:10:40</td>\n",
- " <td>Female</td>\n",
- " <td>Family</td>\n",
- " <td>4</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>259</th>\n",
- " <td>2/15/2024 16:14:11</td>\n",
- " <td>Female</td>\n",
- " <td>Friends</td>\n",
- " <td>3 (room), 8 (hall), ~70 (building)</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "<p>260 rows × 4 columns</p>\n",
- "</div>\n",
- " <div class=\"colab-df-buttons\">\n",
- "\n",
- " <div class=\"colab-df-container\">\n",
- " <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-a860243d-1475-4912-ac7f-83183a2056d2')\"\n",
- " title=\"Convert this dataframe to an interactive table.\"\n",
- " style=\"display:none;\">\n",
- "\n",
- " <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
- " <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
- " </svg>\n",
- " </button>\n",
- "\n",
- " <style>\n",
- " .colab-df-container {\n",
- " display:flex;\n",
- " gap: 12px;\n",
- " }\n",
- "\n",
- " .colab-df-convert {\n",
- " background-color: #E8F0FE;\n",
- " border: none;\n",
- " border-radius: 50%;\n",
- " cursor: pointer;\n",
- " display: none;\n",
- " fill: #1967D2;\n",
- " height: 32px;\n",
- " padding: 0 0 0 0;\n",
- " width: 32px;\n",
- " }\n",
- "\n",
- " .colab-df-convert:hover {\n",
- " background-color: #E2EBFA;\n",
- " box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
- " fill: #174EA6;\n",
- " }\n",
- "\n",
- " .colab-df-buttons div {\n",
- " margin-bottom: 4px;\n",
- " }\n",
- "\n",
- " [theme=dark] .colab-df-convert {\n",
- " background-color: #3B4455;\n",
- " fill: #D2E3FC;\n",
- " }\n",
- "\n",
- " [theme=dark] .colab-df-convert:hover {\n",
- " background-color: #434B5C;\n",
- " box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
- " filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
- " fill: #FFFFFF;\n",
- " }\n",
- " </style>\n",
- "\n",
- " <script>\n",
- " const buttonEl =\n",
- " document.querySelector('#df-a860243d-1475-4912-ac7f-83183a2056d2 button.colab-df-convert');\n",
- " buttonEl.style.display =\n",
- " google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
- "\n",
- " async function convertToInteractive(key) {\n",
- " const element = document.querySelector('#df-a860243d-1475-4912-ac7f-83183a2056d2');\n",
- " const dataTable =\n",
- " await google.colab.kernel.invokeFunction('convertToInteractive',\n",
- " [key], {});\n",
- " if (!dataTable) return;\n",
- "\n",
- " const docLinkHtml = 'Like what you see? Visit the ' +\n",
- " '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
- " + ' to learn more about interactive tables.';\n",
- " element.innerHTML = '';\n",
- " dataTable['output_type'] = 'display_data';\n",
- " await google.colab.output.renderOutput(dataTable, element);\n",
- " const docLink = document.createElement('div');\n",
- " docLink.innerHTML = docLinkHtml;\n",
- " element.appendChild(docLink);\n",
- " }\n",
- " </script>\n",
- " </div>\n",
- "\n",
- "\n",
- "<div id=\"df-1a09fda8-d71a-4c48-b8e2-b45a93914e4e\">\n",
- " <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-1a09fda8-d71a-4c48-b8e2-b45a93914e4e')\"\n",
- " title=\"Suggest charts\"\n",
- " style=\"display:none;\">\n",
- "\n",
- "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
- " width=\"24px\">\n",
- " <g>\n",
- " <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
- " </g>\n",
- "</svg>\n",
- " </button>\n",
- "\n",
- "<style>\n",
- " .colab-df-quickchart {\n",
- " --bg-color: #E8F0FE;\n",
- " --fill-color: #1967D2;\n",
- " --hover-bg-color: #E2EBFA;\n",
- " --hover-fill-color: #174EA6;\n",
- " --disabled-fill-color: #AAA;\n",
- " --disabled-bg-color: #DDD;\n",
- " }\n",
- "\n",
- " [theme=dark] .colab-df-quickchart {\n",
- " --bg-color: #3B4455;\n",
- " --fill-color: #D2E3FC;\n",
- " --hover-bg-color: #434B5C;\n",
- " --hover-fill-color: #FFFFFF;\n",
- " --disabled-bg-color: #3B4455;\n",
- " --disabled-fill-color: #666;\n",
- " }\n",
- "\n",
- " .colab-df-quickchart {\n",
- " background-color: var(--bg-color);\n",
- " border: none;\n",
- " border-radius: 50%;\n",
- " cursor: pointer;\n",
- " display: none;\n",
- " fill: var(--fill-color);\n",
- " height: 32px;\n",
- " padding: 0;\n",
- " width: 32px;\n",
- " }\n",
- "\n",
- " .colab-df-quickchart:hover {\n",
- " background-color: var(--hover-bg-color);\n",
- " box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
- " fill: var(--button-hover-fill-color);\n",
- " }\n",
- "\n",
- " .colab-df-quickchart-complete:disabled,\n",
- " .colab-df-quickchart-complete:disabled:hover {\n",
- " background-color: var(--disabled-bg-color);\n",
- " fill: var(--disabled-fill-color);\n",
- " box-shadow: none;\n",
- " }\n",
- "\n",
- " .colab-df-spinner {\n",
- " border: 2px solid var(--fill-color);\n",
- " border-color: transparent;\n",
- " border-bottom-color: var(--fill-color);\n",
- " animation:\n",
- " spin 1s steps(1) infinite;\n",
- " }\n",
- "\n",
- " @keyframes spin {\n",
- " 0% {\n",
- " border-color: transparent;\n",
- " border-bottom-color: var(--fill-color);\n",
- " border-left-color: var(--fill-color);\n",
- " }\n",
- " 20% {\n",
- " border-color: transparent;\n",
- " border-left-color: var(--fill-color);\n",
- " border-top-color: var(--fill-color);\n",
- " }\n",
- " 30% {\n",
- " border-color: transparent;\n",
- " border-left-color: var(--fill-color);\n",
- " border-top-color: var(--fill-color);\n",
- " border-right-color: var(--fill-color);\n",
- " }\n",
- " 40% {\n",
- " border-color: transparent;\n",
- " border-right-color: var(--fill-color);\n",
- " border-top-color: var(--fill-color);\n",
- " }\n",
- " 60% {\n",
- " border-color: transparent;\n",
- " border-right-color: var(--fill-color);\n",
- " }\n",
- " 80% {\n",
- " border-color: transparent;\n",
- " border-right-color: var(--fill-color);\n",
- " border-bottom-color: var(--fill-color);\n",
- " }\n",
- " 90% {\n",
- " border-color: transparent;\n",
- " border-bottom-color: var(--fill-color);\n",
- " }\n",
- " }\n",
- "</style>\n",
- "\n",
- " <script>\n",
- " async function quickchart(key) {\n",
- " const quickchartButtonEl =\n",
- " document.querySelector('#' + key + ' button');\n",
- " quickchartButtonEl.disabled = true; // To prevent multiple clicks.\n",
- " quickchartButtonEl.classList.add('colab-df-spinner');\n",
- " try {\n",
- " const charts = await google.colab.kernel.invokeFunction(\n",
- " 'suggestCharts', [key], {});\n",
- " } catch (error) {\n",
- " console.error('Error during call to suggestCharts:', error);\n",
- " }\n",
- " quickchartButtonEl.classList.remove('colab-df-spinner');\n",
- " quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
- " }\n",
- " (() => {\n",
- " let quickchartButtonEl =\n",
- " document.querySelector('#df-1a09fda8-d71a-4c48-b8e2-b45a93914e4e button');\n",
- " quickchartButtonEl.style.display =\n",
- " google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
- " })();\n",
- " </script>\n",
- "</div>\n",
- " </div>\n",
- " </div>\n"
- ],
- "application/vnd.google.colaboratory.intrinsic+json": {
- "type": "dataframe",
- "variable_name": "df2",
- "summary": "{\n \"name\": \"df2\",\n \"rows\": 260,\n \"fields\": [\n {\n \"column\": \"Timestamp\",\n \"properties\": {\n \"dtype\": \"object\",\n \"min\": \"2/10/2024 0:03:14\",\n \"max\": \"2/9/2024 23:56:18\",\n \"samples\": [\n \"2/9/2024 22:54:55\",\n \"2/12/2024 2:12:41\",\n \"2/12/2024 19:19:36\"\n ],\n \"num_unique_values\": 260,\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"What gender do you identify as?\",\n \"properties\": {\n \"dtype\": \"category\",\n \"samples\": [\n \"Female\",\n \"Non-binary\",\n \"Male\"\n ],\n \"num_unique_values\": 4,\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Who do you live with? \",\n \"properties\": {\n \"dtype\": \"category\",\n \"samples\": [\n \"Neither\",\n \"Both\",\n \"Family, Friends, Both\"\n ],\n \"num_unique_values\": 6,\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"How many people live in your household?\",\n \"properties\": {\n \"dtype\": \"category\",\n \"samples\": [\n \"6\",\n \"4\",\n \"2\"\n ],\n \"num_unique_values\": 17,\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"
- }
- },
- "metadata": {},
- "execution_count": 1
- }
- ],
- "source": [
- "%matplotlib inline\n",
- "import pandas as pd\n",
- "import numpy as np\n",
- "\n",
- "df = pd.read_csv(\"CS105 W24 Survey (Responses) - Form Responses 1.csv\")\n",
- "#df\n",
- "df2 = df.iloc[:, [0, 5, 7, 9]]\n",
- "df2"
- ]
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "daa13044",
+ "metadata": {
+ "id": "daa13044",
+ "outputId": "4d440aaa-1ee7-4771-c526-f55e9458ca8a",
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 614
},
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "29889175",
- "metadata": {
- "id": "29889175"
- },
- "outputs": [],
- "source": []
+ "ExecuteTime": {
+ "end_time": "2024-02-16T00:28:29.748265Z",
+ "start_time": "2024-02-16T00:28:29.708379Z"
}
- ],
- "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.5"
- },
- "colab": {
- "provenance": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": " Timestamp What gender do you identify as? \\\n0 2/9/2024 20:12:14 Male \n1 2/9/2024 20:16:34 Female \n2 2/9/2024 20:18:55 Female \n3 2/9/2024 20:24:00 Male \n4 2/9/2024 20:26:16 Male \n.. ... ... \n255 2/14/2024 19:46:28 Male \n256 2/15/2024 0:28:38 Male \n257 2/15/2024 8:33:45 Male \n258 2/15/2024 16:10:40 Female \n259 2/15/2024 16:14:11 Female \n\n Who do you live with? How many people live in your household? \n0 Neither 6 \n1 Both 4 \n2 Friends 4 \n3 Neither 1 \n4 Neither 1 \n.. ... ... \n255 Friends 5 \n256 Family North District 4 bed 2 bath \n257 Family 9 \n258 Family 4 \n259 Friends 3 (room), 8 (hall), ~70 (building) \n\n[260 rows x 4 columns]",
+ "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>Timestamp</th>\n <th>What gender do you identify as?</th>\n <th>Who do you live with?</th>\n <th>How many people live in your household?</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>2/9/2024 20:12:14</td>\n <td>Male</td>\n <td>Neither</td>\n <td>6</td>\n </tr>\n <tr>\n <th>1</th>\n <td>2/9/2024 20:16:34</td>\n <td>Female</td>\n <td>Both</td>\n <td>4</td>\n </tr>\n <tr>\n <th>2</th>\n <td>2/9/2024 20:18:55</td>\n <td>Female</td>\n <td>Friends</td>\n <td>4</td>\n </tr>\n <tr>\n <th>3</th>\n <td>2/9/2024 20:24:00</td>\n <td>Male</td>\n <td>Neither</td>\n <td>1</td>\n </tr>\n <tr>\n <th>4</th>\n <td>2/9/2024 20:26:16</td>\n <td>Male</td>\n <td>Neither</td>\n <td>1</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>255</th>\n <td>2/14/2024 19:46:28</td>\n <td>Male</td>\n <td>Friends</td>\n <td>5</td>\n </tr>\n <tr>\n <th>256</th>\n <td>2/15/2024 0:28:38</td>\n <td>Male</td>\n <td>Family</td>\n <td>North District 4 bed 2 bath</td>\n </tr>\n <tr>\n <th>257</th>\n <td>2/15/2024 8:33:45</td>\n <td>Male</td>\n <td>Family</td>\n <td>9</td>\n </tr>\n <tr>\n <th>258</th>\n <td>2/15/2024 16:10:40</td>\n <td>Female</td>\n <td>Family</td>\n <td>4</td>\n </tr>\n <tr>\n <th>259</th>\n <td>2/15/2024 16:14:11</td>\n <td>Female</td>\n <td>Friends</td>\n <td>3 (room), 8 (hall), ~70 (building)</td>\n </tr>\n </tbody>\n</table>\n<p>260 rows × 4 columns</p>\n</div>"
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
}
+ ],
+ "source": [
+ "%matplotlib inline\n",
+ "import pandas as pd\n",
+ "import numpy as np\n",
+ "\n",
+ "df = pd.read_csv(\"data.csv\")\n",
+ "#df\n",
+ "df2 = df.iloc[:, [0, 5, 7, 9]]\n",
+ "df2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "29889175",
+ "metadata": {
+ "id": "29889175"
+ },
+ "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.11.5"
},
- "nbformat": 4,
- "nbformat_minor": 5
-} \ No newline at end of file
+ "colab": {
+ "provenance": []
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}