Rtkhoury/Coding_workshop_2
0
1{2 "cells": [3 {4 "cell_type": "markdown",5 "metadata": {6 "id": "kz8lLSv6mVQo"7 },8 "source": [9 "# **๐ค Data Analysis & Visualization**"10 ]11 },12 {13 "cell_type": "markdown",14 "metadata": {15 "id": "jpASMyIQMaAq"16 },17 "source": [18 "## **1.** ๐ฆ Install required packages"19 ]20 },21 {22 "cell_type": "code",23 "execution_count": 27,24 "metadata": {25 "colab": {26 "base_uri": "https://localhost:8080/"27 },28 "id": "f48c8f8c",29 "outputId": "3686c11e-b211-43ea-ee64-9f7e854ecd5d"30 },31 "outputs": [32 {33 "output_type": "stream",34 "name": "stdout",35 "text": [36 "Requirement already satisfied: pandas in /usr/local/lib/python3.12/dist-packages (2.2.2)\n",37 "Requirement already satisfied: matplotlib in /usr/local/lib/python3.12/dist-packages (3.10.0)\n",38 "Requirement already satisfied: seaborn in /usr/local/lib/python3.12/dist-packages (0.13.2)\n",39 "Requirement already satisfied: numpy in /usr/local/lib/python3.12/dist-packages (2.0.2)\n",40 "Requirement already satisfied: textblob in /usr/local/lib/python3.12/dist-packages (0.19.0)\n",41 "Collecting faker\n",42 " Downloading faker-40.8.0-py3-none-any.whl.metadata (16 kB)\n",43 "Requirement already satisfied: transformers in /usr/local/lib/python3.12/dist-packages (5.0.0)\n",44 "Requirement already satisfied: vaderSentiment in /usr/local/lib/python3.12/dist-packages (3.3.2)\n",45 "Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.12/dist-packages (from pandas) (2.9.0.post0)\n",46 "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.12/dist-packages (from pandas) (2025.2)\n",47 "Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.12/dist-packages (from pandas) (2025.3)\n",48 "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.12/dist-packages (from matplotlib) (1.3.3)\n",49 "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.12/dist-packages (from matplotlib) (0.12.1)\n",50 "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.12/dist-packages (from matplotlib) (4.61.1)\n",51 "Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.12/dist-packages (from matplotlib) (1.4.9)\n",52 "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.12/dist-packages (from matplotlib) (26.0)\n",53 "Requirement already satisfied: pillow>=8 in /usr/local/lib/python3.12/dist-packages (from matplotlib) (11.3.0)\n",54 "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.12/dist-packages (from matplotlib) (3.3.2)\n",55 "Requirement already satisfied: nltk>=3.9 in /usr/local/lib/python3.12/dist-packages (from textblob) (3.9.1)\n",56 "Requirement already satisfied: filelock in /usr/local/lib/python3.12/dist-packages (from transformers) (3.24.3)\n",57 "Requirement already satisfied: huggingface-hub<2.0,>=1.3.0 in /usr/local/lib/python3.12/dist-packages (from transformers) (1.5.0)\n",58 "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.12/dist-packages (from transformers) (6.0.3)\n",59 "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.12/dist-packages (from transformers) (2025.11.3)\n",60 "Requirement already satisfied: tokenizers<=0.23.0,>=0.22.0 in /usr/local/lib/python3.12/dist-packages (from transformers) (0.22.2)\n",61 "Requirement already satisfied: typer-slim in /usr/local/lib/python3.12/dist-packages (from transformers) (0.24.0)\n",62 "Requirement already satisfied: safetensors>=0.4.3 in /usr/local/lib/python3.12/dist-packages (from transformers) (0.7.0)\n",63 "Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.12/dist-packages (from transformers) (4.67.3)\n",64 "Requirement already satisfied: requests in /usr/local/lib/python3.12/dist-packages (from vaderSentiment) (2.32.4)\n",65 "Requirement already satisfied: fsspec>=2023.5.0 in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<2.0,>=1.3.0->transformers) (2025.3.0)\n",66 "Requirement already satisfied: hf-xet<2.0.0,>=1.2.0 in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<2.0,>=1.3.0->transformers) (1.3.1)\n",67 "Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<2.0,>=1.3.0->transformers) (0.28.1)\n",68 "Requirement already satisfied: typer in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<2.0,>=1.3.0->transformers) (0.24.1)\n",69 "Requirement already satisfied: typing-extensions>=4.1.0 in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<2.0,>=1.3.0->transformers) (4.15.0)\n",70 "Requirement already satisfied: click in /usr/local/lib/python3.12/dist-packages (from nltk>=3.9->textblob) (8.3.1)\n",71 "Requirement already satisfied: joblib in /usr/local/lib/python3.12/dist-packages (from nltk>=3.9->textblob) (1.5.3)\n",72 "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.12/dist-packages (from python-dateutil>=2.8.2->pandas) (1.17.0)\n",73 "Requirement already satisfied: charset_normalizer<4,>=2 in /usr/local/lib/python3.12/dist-packages (from requests->vaderSentiment) (3.4.4)\n",74 "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.12/dist-packages (from requests->vaderSentiment) (3.11)\n",75 "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.12/dist-packages (from requests->vaderSentiment) (2.5.0)\n",76 "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.12/dist-packages (from requests->vaderSentiment) (2026.2.25)\n",77 "Requirement already satisfied: anyio in /usr/local/lib/python3.12/dist-packages (from httpx<1,>=0.23.0->huggingface-hub<2.0,>=1.3.0->transformers) (4.12.1)\n",78 "Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.12/dist-packages (from httpx<1,>=0.23.0->huggingface-hub<2.0,>=1.3.0->transformers) (1.0.9)\n",79 "Requirement already satisfied: h11>=0.16 in /usr/local/lib/python3.12/dist-packages (from httpcore==1.*->httpx<1,>=0.23.0->huggingface-hub<2.0,>=1.3.0->transformers) (0.16.0)\n",80 "Requirement already satisfied: shellingham>=1.3.0 in /usr/local/lib/python3.12/dist-packages (from typer->huggingface-hub<2.0,>=1.3.0->transformers) (1.5.4)\n",81 "Requirement already satisfied: rich>=12.3.0 in /usr/local/lib/python3.12/dist-packages (from typer->huggingface-hub<2.0,>=1.3.0->transformers) (13.9.4)\n",82 "Requirement already satisfied: annotated-doc>=0.0.2 in /usr/local/lib/python3.12/dist-packages (from typer->huggingface-hub<2.0,>=1.3.0->transformers) (0.0.4)\n",83 "Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.12/dist-packages (from rich>=12.3.0->typer->huggingface-hub<2.0,>=1.3.0->transformers) (4.0.0)\n",84 "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.12/dist-packages (from rich>=12.3.0->typer->huggingface-hub<2.0,>=1.3.0->transformers) (2.19.2)\n",85 "Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.12/dist-packages (from markdown-it-py>=2.2.0->rich>=12.3.0->typer->huggingface-hub<2.0,>=1.3.0->transformers) (0.1.2)\n",86 "Downloading faker-40.8.0-py3-none-any.whl (2.0 MB)\n",87 "\u001b[2K \u001b[90mโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\u001b[0m \u001b[32m2.0/2.0 MB\u001b[0m \u001b[31m12.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",88 "\u001b[?25hInstalling collected packages: faker\n",89 "Successfully installed faker-40.8.0\n"90 ]91 }92 ],93 "source": [94 "!pip install pandas matplotlib seaborn numpy textblob faker transformers vaderSentiment\n"95 ]96 },97 {98 "cell_type": "markdown",99 "metadata": {100 "id": "NZd99NpKkKyp"101 },102 "source": [103 "## **2.** โ
๏ธ Load & inspect input datasets"104 ]105 },106 {107 "cell_type": "markdown",108 "metadata": {109 "id": "_JBLmm508Uq2"110 },111 "source": [112 "### *a. Initial setup*"113 ]114 },115 {116 "cell_type": "code",117 "execution_count": 28,118 "metadata": {119 "id": "eBDXPQz18Xrs"120 },121 "outputs": [],122 "source": [123 "import pandas as pd\n",124 "import numpy as np\n",125 "import random"126 ]127 },128 {129 "cell_type": "markdown",130 "metadata": {131 "id": "IL8lZbMm8m3k"132 },133 "source": [134 "### *b. โ๐ป๐โ๏ธ Create the df_reviews dataframe from the synthetic_book_reviews.csv file*"135 ]136 },137 {138 "cell_type": "code",139 "execution_count": 29,140 "metadata": {141 "id": "fdgjghfO8uuq"142 },143 "outputs": [],144 "source": [145 "df_reviews = pd.read_csv(\"synthetic_book_reviews.csv\")"146 ]147 },148 {149 "cell_type": "markdown",150 "metadata": {151 "id": "N-Dl37J0HLhU"152 },153 "source": [154 "### *c. โ๐ป๐โ๏ธ Create the df_sales dataframe from the synthetic_sales_data.csv file*"155 ]156 },157 {158 "cell_type": "code",159 "execution_count": 30,160 "metadata": {161 "id": "6XZs3P7fHgQe"162 },163 "outputs": [],164 "source": [165 "df_sales = pd.read_csv(\"synthetic_sales_data.csv\")"166 ]167 },168 {169 "cell_type": "markdown",170 "metadata": {171 "id": "MUI3SkmyrGQo"172 },173 "source": [174 "### *d. โ๐ป๐โ๏ธ Visualize the first few lines of the two final datasets: df_reviews and df_sales*"175 ]176 },177 {178 "cell_type": "code",179 "execution_count": 69,180 "metadata": {181 "colab": {182 "base_uri": "https://localhost:8080/",183 "height": 487184 },185 "id": "p8FdQFXErOqE",186 "outputId": "cb0b3b9a-66da-4327-ab2c-8593aaf97a71"187 },188 "outputs": [189 {190 "output_type": "execute_result",191 "data": {192 "text/plain": [193 " title sentiment_label \\\n",194 "0 A Light in the Attic neutral \n",195 "1 A Light in the Attic neutral \n",196 "2 A Light in the Attic neutral \n",197 "3 A Light in the Attic neutral \n",198 "4 A Light in the Attic neutral \n",199 "\n",200 " review_text rating popularity_score \n",201 "0 A competent effort, but lacked a spark. Three 3 \n",202 "1 The pacing felt a bit off at times. Three 3 \n",203 "2 Standard fare with some promise. Three 3 \n",204 "3 It was just... fine. Three 3 \n",205 "4 The concept was good, but the execution was la... Three 3 "206 ],207 "text/html": [208 "\n",209 " <div id=\"df-ef08c8cd-d964-41f5-9e06-7e9ad48f4d63\" class=\"colab-df-container\">\n",210 " <div>\n",211 "<style scoped>\n",212 " .dataframe tbody tr th:only-of-type {\n",213 " vertical-align: middle;\n",214 " }\n",215 "\n",216 " .dataframe tbody tr th {\n",217 " vertical-align: top;\n",218 " }\n",219 "\n",220 " .dataframe thead th {\n",221 " text-align: right;\n",222 " }\n",223 "</style>\n",224 "<table border=\"1\" class=\"dataframe\">\n",225 " <thead>\n",226 " <tr style=\"text-align: right;\">\n",227 " <th></th>\n",228 " <th>title</th>\n",229 " <th>sentiment_label</th>\n",230 " <th>review_text</th>\n",231 " <th>rating</th>\n",232 " <th>popularity_score</th>\n",233 " </tr>\n",234 " </thead>\n",235 " <tbody>\n",236 " <tr>\n",237 " <th>0</th>\n",238 " <td>A Light in the Attic</td>\n",239 " <td>neutral</td>\n",240 " <td>A competent effort, but lacked a spark.</td>\n",241 " <td>Three</td>\n",242 " <td>3</td>\n",243 " </tr>\n",244 " <tr>\n",245 " <th>1</th>\n",246 " <td>A Light in the Attic</td>\n",247 " <td>neutral</td>\n",248 " <td>The pacing felt a bit off at times.</td>\n",249 " <td>Three</td>\n",250 " <td>3</td>\n",251 " </tr>\n",252 " <tr>\n",253 " <th>2</th>\n",254 " <td>A Light in the Attic</td>\n",255 " <td>neutral</td>\n",256 " <td>Standard fare with some promise.</td>\n",257 " <td>Three</td>\n",258 " <td>3</td>\n",259 " </tr>\n",260 " <tr>\n",261 " <th>3</th>\n",262 " <td>A Light in the Attic</td>\n",263 " <td>neutral</td>\n",264 " <td>It was just... fine.</td>\n",265 " <td>Three</td>\n",266 " <td>3</td>\n",267 " </tr>\n",268 " <tr>\n",269 " <th>4</th>\n",270 " <td>A Light in the Attic</td>\n",271 " <td>neutral</td>\n",272 " <td>The concept was good, but the execution was la...</td>\n",273 " <td>Three</td>\n",274 " <td>3</td>\n",275 " </tr>\n",276 " </tbody>\n",277 "</table>\n",278 "</div>\n",279 " <div class=\"colab-df-buttons\">\n",280 "\n",281 " <div class=\"colab-df-container\">\n",282 " <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-ef08c8cd-d964-41f5-9e06-7e9ad48f4d63')\"\n",283 " title=\"Convert this dataframe to an interactive table.\"\n",284 " style=\"display:none;\">\n",285 "\n",286 " <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",287 " <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",288 " </svg>\n",289 " </button>\n",290 "\n",291 " <style>\n",292 " .colab-df-container {\n",293 " display:flex;\n",294 " gap: 12px;\n",295 " }\n",296 "\n",297 " .colab-df-convert {\n",298 " background-color: #E8F0FE;\n",299 " border: none;\n",300 " border-radius: 50%;\n",301 " cursor: pointer;\n",302 " display: none;\n",303 " fill: #1967D2;\n",304 " height: 32px;\n",305 " padding: 0 0 0 0;\n",306 " width: 32px;\n",307 " }\n",308 "\n",309 " .colab-df-convert:hover {\n",310 " background-color: #E2EBFA;\n",311 " box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",312 " fill: #174EA6;\n",313 " }\n",314 "\n",315 " .colab-df-buttons div {\n",316 " margin-bottom: 4px;\n",317 " }\n",318 "\n",319 " [theme=dark] .colab-df-convert {\n",320 " background-color: #3B4455;\n",321 " fill: #D2E3FC;\n",322 " }\n",323 "\n",324 " [theme=dark] .colab-df-convert:hover {\n",325 " background-color: #434B5C;\n",326 " box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",327 " filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",328 " fill: #FFFFFF;\n",329 " }\n",330 " </style>\n",331 "\n",332 " <script>\n",333 " const buttonEl =\n",334 " document.querySelector('#df-ef08c8cd-d964-41f5-9e06-7e9ad48f4d63 button.colab-df-convert');\n",335 " buttonEl.style.display =\n",336 " google.colab.kernel.accessAllowed ? 'block' : 'none';\n",337 "\n",338 " async function convertToInteractive(key) {\n",339 " const element = document.querySelector('#df-ef08c8cd-d964-41f5-9e06-7e9ad48f4d63');\n",340 " const dataTable =\n",341 " await google.colab.kernel.invokeFunction('convertToInteractive',\n",342 " [key], {});\n",343 " if (!dataTable) return;\n",344 "\n",345 " const docLinkHtml = 'Like what you see? Visit the ' +\n",346 " '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",347 " + ' to learn more about interactive tables.';\n",348 " element.innerHTML = '';\n",349 " dataTable['output_type'] = 'display_data';\n",350 " await google.colab.output.renderOutput(dataTable, element);\n",351 " const docLink = document.createElement('div');\n",352 " docLink.innerHTML = docLinkHtml;\n",353 " element.appendChild(docLink);\n",354 " }\n",355 " </script>\n",356 " </div>\n",357 "\n",358 "\n",359 " </div>\n",360 " </div>\n"361 ],362 "application/vnd.google.colaboratory.intrinsic+json": {363 "type": "dataframe",364 "variable_name": "df_reviews",365 "summary": "{\n \"name\": \"df_reviews\",\n \"rows\": 10000,\n \"fields\": [\n {\n \"column\": \"title\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 999,\n \"samples\": [\n \"The Grownup\",\n \"Persepolis: The Story of a Childhood (Persepolis #1-2)\",\n \"Ayumi's Violin\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"sentiment_label\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 3,\n \"samples\": [\n \"neutral\",\n \"negative\",\n \"positive\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"review_text\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 135,\n \"samples\": [\n \"A fairly unremarkable book.\",\n \"A vibrant and immersive experience. I felt like I was right there with the characters.\",\n \"A frustrating and irritating read. I just wanted it to be over.\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"rating\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 5,\n \"samples\": [\n \"One\",\n \"Two\",\n \"Four\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"popularity_score\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 1,\n \"max\": 5,\n \"num_unique_values\": 5,\n \"samples\": [\n 2,\n 5,\n 4\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"366 }367 },368 "metadata": {},369 "execution_count": 69370 }371 ],372 "source": [373 "df_reviews.head()"374 ]375 },376 {377 "cell_type": "markdown",378 "metadata": {379 "id": "Y3oqGHsmrQzx"380 },381 "source": [382 "### *d. Run a quality check on the datasets*"383 ]384 },385 {386 "cell_type": "code",387 "execution_count": 31,388 "metadata": {389 "colab": {390 "base_uri": "https://localhost:8080/",391 "height": 1000392 },393 "id": "VArQGPoKrfLm",394 "outputId": "6a8e4d40-ea1d-4049-9257-344da5ccbf34"395 },396 "outputs": [397 {398 "output_type": "stream",399 "name": "stdout",400 "text": [401 "\n",402 "๐ Quality Check Report for: df_reviews\n",403 "===================================\n",404 "\n",405 "๐ Shape: (10000, 5)\n",406 "\n",407 "๐ Column Types:\n",408 "title object\n",409 "sentiment_label object\n",410 "review_text object\n",411 "rating object\n",412 "popularity_score int64\n",413 "dtype: object\n",414 "\n",415 "โ Missing Values:\n",416 "title 0\n",417 "sentiment_label 0\n",418 "review_text 0\n",419 "rating 0\n",420 "popularity_score 0\n",421 "dtype: int64\n",422 "\n",423 "๐ Duplicate Rows: 0\n",424 "\n",425 "๐ Summary Statistics:\n"426 ]427 },428 {429 "output_type": "display_data",430 "data": {431 "text/plain": [432 " count unique \\\n",433 "title 10000 999 \n",434 "sentiment_label 10000 3 \n",435 "review_text 10000 135 \n",436 "rating 10000 5 \n",437 "popularity_score 10000.0 NaN \n",438 "\n",439 " top freq \\\n",440 "title The Star-Touched Queen 20 \n",441 "sentiment_label positive 4380 \n",442 "review_text A captivating read that offered both escapism ... 112 \n",443 "rating One 2260 \n",444 "popularity_score NaN NaN \n",445 "\n",446 " mean std min 25% 50% 75% max \n",447 "title NaN NaN NaN NaN NaN NaN NaN \n",448 "sentiment_label NaN NaN NaN NaN NaN NaN NaN \n",449 "review_text NaN NaN NaN NaN NaN NaN NaN \n",450 "rating NaN NaN NaN NaN NaN NaN NaN \n",451 "popularity_score 3.282 1.028874 1.0 3.0 3.0 4.0 5.0 "452 ],453 "text/html": [454 "\n",455 " <div id=\"df-8d327aeb-fc15-4f2c-91e2-8ef9e55f569e\" class=\"colab-df-container\">\n",456 " <div>\n",457 "<style scoped>\n",458 " .dataframe tbody tr th:only-of-type {\n",459 " vertical-align: middle;\n",460 " }\n",461 "\n",462 " .dataframe tbody tr th {\n",463 " vertical-align: top;\n",464 " }\n",465 "\n",466 " .dataframe thead th {\n",467 " text-align: right;\n",468 " }\n",469 "</style>\n",470 "<table border=\"1\" class=\"dataframe\">\n",471 " <thead>\n",472 " <tr style=\"text-align: right;\">\n",473 " <th></th>\n",474 " <th>count</th>\n",475 " <th>unique</th>\n",476 " <th>top</th>\n",477 " <th>freq</th>\n",478 " <th>mean</th>\n",479 " <th>std</th>\n",480 " <th>min</th>\n",481 " <th>25%</th>\n",482 " <th>50%</th>\n",483 " <th>75%</th>\n",484 " <th>max</th>\n",485 " </tr>\n",486 " </thead>\n",487 " <tbody>\n",488 " <tr>\n",489 " <th>title</th>\n",490 " <td>10000</td>\n",491 " <td>999</td>\n",492 " <td>The Star-Touched Queen</td>\n",493 " <td>20</td>\n",494 " <td>NaN</td>\n",495 " <td>NaN</td>\n",496 " <td>NaN</td>\n",497 " <td>NaN</td>\n",498 " <td>NaN</td>\n",499 " <td>NaN</td>\n",500 " <td>NaN</td>\n",501 " </tr>\n",502 " <tr>\n",503 " <th>sentiment_label</th>\n",504 " <td>10000</td>\n",505 " <td>3</td>\n",506 " <td>positive</td>\n",507 " <td>4380</td>\n",508 " <td>NaN</td>\n",509 " <td>NaN</td>\n",510 " <td>NaN</td>\n",511 " <td>NaN</td>\n",512 " <td>NaN</td>\n",513 " <td>NaN</td>\n",514 " <td>NaN</td>\n",515 " </tr>\n",516 " <tr>\n",517 " <th>review_text</th>\n",518 " <td>10000</td>\n",519 " <td>135</td>\n",520 " <td>A captivating read that offered both escapism ...</td>\n",521 " <td>112</td>\n",522 " <td>NaN</td>\n",523 " <td>NaN</td>\n",524 " <td>NaN</td>\n",525 " <td>NaN</td>\n",526 " <td>NaN</td>\n",527 " <td>NaN</td>\n",528 " <td>NaN</td>\n",529 " </tr>\n",530 " <tr>\n",531 " <th>rating</th>\n",532 " <td>10000</td>\n",533 " <td>5</td>\n",534 " <td>One</td>\n",535 " <td>2260</td>\n",536 " <td>NaN</td>\n",537 " <td>NaN</td>\n",538 " <td>NaN</td>\n",539 " <td>NaN</td>\n",540 " <td>NaN</td>\n",541 " <td>NaN</td>\n",542 " <td>NaN</td>\n",543 " </tr>\n",544 " <tr>\n",545 " <th>popularity_score</th>\n",546 " <td>10000.0</td>\n",547 " <td>NaN</td>\n",548 " <td>NaN</td>\n",549 " <td>NaN</td>\n",550 " <td>3.282</td>\n",551 " <td>1.028874</td>\n",552 " <td>1.0</td>\n",553 " <td>3.0</td>\n",554 " <td>3.0</td>\n",555 " <td>4.0</td>\n",556 " <td>5.0</td>\n",557 " </tr>\n",558 " </tbody>\n",559 "</table>\n",560 "</div>\n",561 " <div class=\"colab-df-buttons\">\n",562 "\n",563 " <div class=\"colab-df-container\">\n",564 " <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-8d327aeb-fc15-4f2c-91e2-8ef9e55f569e')\"\n",565 " title=\"Convert this dataframe to an interactive table.\"\n",566 " style=\"display:none;\">\n",567 "\n",568 " <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",569 " <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",570 " </svg>\n",571 " </button>\n",572 "\n",573 " <style>\n",574 " .colab-df-container {\n",575 " display:flex;\n",576 " gap: 12px;\n",577 " }\n",578 "\n",579 " .colab-df-convert {\n",580 " background-color: #E8F0FE;\n",581 " border: none;\n",582 " border-radius: 50%;\n",583 " cursor: pointer;\n",584 " display: none;\n",585 " fill: #1967D2;\n",586 " height: 32px;\n",587 " padding: 0 0 0 0;\n",588 " width: 32px;\n",589 " }\n",590 "\n",591 " .colab-df-convert:hover {\n",592 " background-color: #E2EBFA;\n",593 " box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",594 " fill: #174EA6;\n",595 " }\n",596 "\n",597 " .colab-df-buttons div {\n",598 " margin-bottom: 4px;\n",599 " }\n",600 "\n",601 " [theme=dark] .colab-df-convert {\n",602 " background-color: #3B4455;\n",603 " fill: #D2E3FC;\n",604 " }\n",605 "\n",606 " [theme=dark] .colab-df-convert:hover {\n",607 " background-color: #434B5C;\n",608 " box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",609 " filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",610 " fill: #FFFFFF;\n",611 " }\n",612 " </style>\n",613 "\n",614 " <script>\n",615 " const buttonEl =\n",616 " document.querySelector('#df-8d327aeb-fc15-4f2c-91e2-8ef9e55f569e button.colab-df-convert');\n",617 " buttonEl.style.display =\n",618 " google.colab.kernel.accessAllowed ? 'block' : 'none';\n",619 "\n",620 " async function convertToInteractive(key) {\n",621 " const element = document.querySelector('#df-8d327aeb-fc15-4f2c-91e2-8ef9e55f569e');\n",622 " const dataTable =\n",623 " await google.colab.kernel.invokeFunction('convertToInteractive',\n",624 " [key], {});\n",625 " if (!dataTable) return;\n",626 "\n",627 " const docLinkHtml = 'Like what you see? Visit the ' +\n",628 " '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",629 " + ' to learn more about interactive tables.';\n",630 " element.innerHTML = '';\n",631 " dataTable['output_type'] = 'display_data';\n",632 " await google.colab.output.renderOutput(dataTable, element);\n",633 " const docLink = document.createElement('div');\n",634 " docLink.innerHTML = docLinkHtml;\n",635 " element.appendChild(docLink);\n",636 " }\n",637 " </script>\n",638 " </div>\n",639 "\n",640 "\n",641 " </div>\n",642 " </div>\n"643 ],644 "application/vnd.google.colaboratory.intrinsic+json": {645 "type": "dataframe",646 "summary": "{\n \"name\": \"quality_check(df_sales, \\\"df_sales\\\")\",\n \"rows\": 5,\n \"fields\": [\n {\n \"column\": \"count\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": \"10000\",\n \"max\": \"10000\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"10000\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"unique\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 3,\n \"max\": 999,\n \"num_unique_values\": 4,\n \"samples\": [\n 3\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"top\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"positive\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"freq\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": \"20\",\n \"max\": \"4380\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"4380\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"mean\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 3.282,\n \"max\": 3.282,\n \"num_unique_values\": 1,\n \"samples\": [\n 3.282\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"std\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 1.0288740730458223,\n \"max\": 1.0288740730458223,\n \"num_unique_values\": 1,\n \"samples\": [\n 1.0288740730458223\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"min\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 1.0,\n \"max\": 1.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 1.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"25%\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 3.0,\n \"max\": 3.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 3.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"50%\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 3.0,\n \"max\": 3.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 3.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"75%\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 4.0,\n \"max\": 4.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 4.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"max\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 5.0,\n \"max\": 5.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 5.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"647 }648 },649 "metadata": {}650 },651 {652 "output_type": "stream",653 "name": "stdout",654 "text": [655 "\n",656 "๐ Sample Rows:\n"657 ]658 },659 {660 "output_type": "display_data",661 "data": {662 "text/plain": [663 " title sentiment_label \\\n",664 "6349 Critique of Pure Reason negative \n",665 "7391 The Lonely Ones positive \n",666 "2360 The Star-Touched Queen positive \n",667 "2294 This Is Where It Ends positive \n",668 "9195 The Selfish Gene negative \n",669 "\n",670 " review_text rating \\\n",671 "6349 Honestly, I couldn't finish it. It was that bad. One \n",672 "7391 I'm blown away by the creativity and skill. An... Five \n",673 "2360 I'm blown away by the creativity and skill. An... Five \n",674 "2294 Smart, witty, and utterly charming. A wonderfu... Two \n",675 "9195 A predictable and unoriginal story that brings... One \n",676 "\n",677 " popularity_score \n",678 "6349 2 \n",679 "7391 4 \n",680 "2360 4 \n",681 "2294 4 \n",682 "9195 2 "683 ],684 "text/html": [685 "\n",686 " <div id=\"df-bfea5134-a37d-4c64-9011-6f5db6de7a05\" class=\"colab-df-container\">\n",687 " <div>\n",688 "<style scoped>\n",689 " .dataframe tbody tr th:only-of-type {\n",690 " vertical-align: middle;\n",691 " }\n",692 "\n",693 " .dataframe tbody tr th {\n",694 " vertical-align: top;\n",695 " }\n",696 "\n",697 " .dataframe thead th {\n",698 " text-align: right;\n",699 " }\n",700 "</style>\n",701 "<table border=\"1\" class=\"dataframe\">\n",702 " <thead>\n",703 " <tr style=\"text-align: right;\">\n",704 " <th></th>\n",705 " <th>title</th>\n",706 " <th>sentiment_label</th>\n",707 " <th>review_text</th>\n",708 " <th>rating</th>\n",709 " <th>popularity_score</th>\n",710 " </tr>\n",711 " </thead>\n",712 " <tbody>\n",713 " <tr>\n",714 " <th>6349</th>\n",715 " <td>Critique of Pure Reason</td>\n",716 " <td>negative</td>\n",717 " <td>Honestly, I couldn't finish it. It was that bad.</td>\n",718 " <td>One</td>\n",719 " <td>2</td>\n",720 " </tr>\n",721 " <tr>\n",722 " <th>7391</th>\n",723 " <td>The Lonely Ones</td>\n",724 " <td>positive</td>\n",725 " <td>I'm blown away by the creativity and skill. An...</td>\n",726 " <td>Five</td>\n",727 " <td>4</td>\n",728 " </tr>\n",729 " <tr>\n",730 " <th>2360</th>\n",731 " <td>The Star-Touched Queen</td>\n",732 " <td>positive</td>\n",733 " <td>I'm blown away by the creativity and skill. An...</td>\n",734 " <td>Five</td>\n",735 " <td>4</td>\n",736 " </tr>\n",737 " <tr>\n",738 " <th>2294</th>\n",739 " <td>This Is Where It Ends</td>\n",740 " <td>positive</td>\n",741 " <td>Smart, witty, and utterly charming. A wonderfu...</td>\n",742 " <td>Two</td>\n",743 " <td>4</td>\n",744 " </tr>\n",745 " <tr>\n",746 " <th>9195</th>\n",747 " <td>The Selfish Gene</td>\n",748 " <td>negative</td>\n",749 " <td>A predictable and unoriginal story that brings...</td>\n",750 " <td>One</td>\n",751 " <td>2</td>\n",752 " </tr>\n",753 " </tbody>\n",754 "</table>\n",755 "</div>\n",756 " <div class=\"colab-df-buttons\">\n",757 "\n",758 " <div class=\"colab-df-container\">\n",759 " <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-bfea5134-a37d-4c64-9011-6f5db6de7a05')\"\n",760 " title=\"Convert this dataframe to an interactive table.\"\n",761 " style=\"display:none;\">\n",762 "\n",763 " <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",764 " <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",765 " </svg>\n",766 " </button>\n",767 "\n",768 " <style>\n",769 " .colab-df-container {\n",770 " display:flex;\n",771 " gap: 12px;\n",772 " }\n",773 "\n",774 " .colab-df-convert {\n",775 " background-color: #E8F0FE;\n",776 " border: none;\n",777 " border-radius: 50%;\n",778 " cursor: pointer;\n",779 " display: none;\n",780 " fill: #1967D2;\n",781 " height: 32px;\n",782 " padding: 0 0 0 0;\n",783 " width: 32px;\n",784 " }\n",785 "\n",786 " .colab-df-convert:hover {\n",787 " background-color: #E2EBFA;\n",788 " box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",789 " fill: #174EA6;\n",790 " }\n",791 "\n",792 " .colab-df-buttons div {\n",793 " margin-bottom: 4px;\n",794 " }\n",795 "\n",796 " [theme=dark] .colab-df-convert {\n",797 " background-color: #3B4455;\n",798 " fill: #D2E3FC;\n",799 " }\n",800 "\n",801 " [theme=dark] .colab-df-convert:hover {\n",802 " background-color: #434B5C;\n",803 " box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",804 " filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",805 " fill: #FFFFFF;\n",806 " }\n",807 " </style>\n",808 "\n",809 " <script>\n",810 " const buttonEl =\n",811 " document.querySelector('#df-bfea5134-a37d-4c64-9011-6f5db6de7a05 button.colab-df-convert');\n",812 " buttonEl.style.display =\n",813 " google.colab.kernel.accessAllowed ? 'block' : 'none';\n",814 "\n",815 " async function convertToInteractive(key) {\n",816 " const element = document.querySelector('#df-bfea5134-a37d-4c64-9011-6f5db6de7a05');\n",817 " const dataTable =\n",818 " await google.colab.kernel.invokeFunction('convertToInteractive',\n",819 " [key], {});\n",820 " if (!dataTable) return;\n",821 "\n",822 " const docLinkHtml = 'Like what you see? Visit the ' +\n",823 " '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",824 " + ' to learn more about interactive tables.';\n",825 " element.innerHTML = '';\n",826 " dataTable['output_type'] = 'display_data';\n",827 " await google.colab.output.renderOutput(dataTable, element);\n",828 " const docLink = document.createElement('div');\n",829 " docLink.innerHTML = docLinkHtml;\n",830 " element.appendChild(docLink);\n",831 " }\n",832 " </script>\n",833 " </div>\n",834 "\n",835 "\n",836 " </div>\n",837 " </div>\n"838 ],839 "application/vnd.google.colaboratory.intrinsic+json": {840 "type": "dataframe",841 "summary": "{\n \"name\": \"quality_check(df_sales, \\\"df_sales\\\")\",\n \"rows\": 5,\n \"fields\": [\n {\n \"column\": \"title\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 5,\n \"samples\": [\n \"The Lonely Ones\",\n \"The Selfish Gene\",\n \"The Star-Touched Queen\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"sentiment_label\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 2,\n \"samples\": [\n \"positive\",\n \"negative\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"review_text\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"I'm blown away by the creativity and skill. An instant classic.\",\n \"A predictable and unoriginal story that brings nothing new to the table.\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"rating\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 3,\n \"samples\": [\n \"One\",\n \"Five\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"popularity_score\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 2,\n \"max\": 4,\n \"num_unique_values\": 2,\n \"samples\": [\n 4,\n 2\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"842 }843 },844 "metadata": {}845 },846 {847 "output_type": "stream",848 "name": "stdout",849 "text": [850 "\n",851 "๐ Quality Check Report for: df_sales\n",852 "=================================\n",853 "\n",854 "๐ Shape: (18000, 4)\n",855 "\n",856 "๐ Column Types:\n",857 "title object\n",858 "month object\n",859 "units_sold int64\n",860 "sentiment_label object\n",861 "dtype: object\n",862 "\n",863 "โ Missing Values:\n",864 "title 0\n",865 "month 0\n",866 "units_sold 0\n",867 "sentiment_label 0\n",868 "dtype: int64\n",869 "\n",870 "๐ Duplicate Rows: 0\n",871 "\n",872 "๐ Summary Statistics:\n"873 ]874 },875 {876 "output_type": "display_data",877 "data": {878 "text/plain": [879 " count unique top freq mean \\\n",880 "title 18000 999 The Star-Touched Queen 36 NaN \n",881 "month 18000 18 2024-09 1000 NaN \n",882 "units_sold 18000.0 NaN NaN NaN 168.024167 \n",883 "sentiment_label 18000 3 positive 7884 NaN \n",884 "\n",885 " std min 25% 50% 75% max \n",886 "title NaN NaN NaN NaN NaN NaN \n",887 "month NaN NaN NaN NaN NaN NaN \n",888 "units_sold 98.656354 0.0 84.0 148.0 262.0 362.0 \n",889 "sentiment_label NaN NaN NaN NaN NaN NaN "890 ],891 "text/html": [892 "\n",893 " <div id=\"df-05c22ad4-7899-40ef-b2e3-9e8de90ac366\" class=\"colab-df-container\">\n",894 " <div>\n",895 "<style scoped>\n",896 " .dataframe tbody tr th:only-of-type {\n",897 " vertical-align: middle;\n",898 " }\n",899 "\n",900 " .dataframe tbody tr th {\n",901 " vertical-align: top;\n",902 " }\n",903 "\n",904 " .dataframe thead th {\n",905 " text-align: right;\n",906 " }\n",907 "</style>\n",908 "<table border=\"1\" class=\"dataframe\">\n",909 " <thead>\n",910 " <tr style=\"text-align: right;\">\n",911 " <th></th>\n",912 " <th>count</th>\n",913 " <th>unique</th>\n",914 " <th>top</th>\n",915 " <th>freq</th>\n",916 " <th>mean</th>\n",917 " <th>std</th>\n",918 " <th>min</th>\n",919 " <th>25%</th>\n",920 " <th>50%</th>\n",921 " <th>75%</th>\n",922 " <th>max</th>\n",923 " </tr>\n",924 " </thead>\n",925 " <tbody>\n",926 " <tr>\n",927 " <th>title</th>\n",928 " <td>18000</td>\n",929 " <td>999</td>\n",930 " <td>The Star-Touched Queen</td>\n",931 " <td>36</td>\n",932 " <td>NaN</td>\n",933 " <td>NaN</td>\n",934 " <td>NaN</td>\n",935 " <td>NaN</td>\n",936 " <td>NaN</td>\n",937 " <td>NaN</td>\n",938 " <td>NaN</td>\n",939 " </tr>\n",940 " <tr>\n",941 " <th>month</th>\n",942 " <td>18000</td>\n",943 " <td>18</td>\n",944 " <td>2024-09</td>\n",945 " <td>1000</td>\n",946 " <td>NaN</td>\n",947 " <td>NaN</td>\n",948 " <td>NaN</td>\n",949 " <td>NaN</td>\n",950 " <td>NaN</td>\n",951 " <td>NaN</td>\n",952 " <td>NaN</td>\n",953 " </tr>\n",954 " <tr>\n",955 " <th>units_sold</th>\n",956 " <td>18000.0</td>\n",957 " <td>NaN</td>\n",958 " <td>NaN</td>\n",959 " <td>NaN</td>\n",960 " <td>168.024167</td>\n",961 " <td>98.656354</td>\n",962 " <td>0.0</td>\n",963 " <td>84.0</td>\n",964 " <td>148.0</td>\n",965 " <td>262.0</td>\n",966 " <td>362.0</td>\n",967 " </tr>\n",968 " <tr>\n",969 " <th>sentiment_label</th>\n",970 " <td>18000</td>\n",971 " <td>3</td>\n",972 " <td>positive</td>\n",973 " <td>7884</td>\n",974 " <td>NaN</td>\n",975 " <td>NaN</td>\n",976 " <td>NaN</td>\n",977 " <td>NaN</td>\n",978 " <td>NaN</td>\n",979 " <td>NaN</td>\n",980 " <td>NaN</td>\n",981 " </tr>\n",982 " </tbody>\n",983 "</table>\n",984 "</div>\n",985 " <div class=\"colab-df-buttons\">\n",986 "\n",987 " <div class=\"colab-df-container\">\n",988 " <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-05c22ad4-7899-40ef-b2e3-9e8de90ac366')\"\n",989 " title=\"Convert this dataframe to an interactive table.\"\n",990 " style=\"display:none;\">\n",991 "\n",992 " <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",993 " <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",994 " </svg>\n",995 " </button>\n",996 "\n",997 " <style>\n",998 " .colab-df-container {\n",999 " display:flex;\n",1000 " gap: 12px;\n",1001 " }\n",1002 "\n",1003 " .colab-df-convert {\n",1004 " background-color: #E8F0FE;\n",1005 " border: none;\n",1006 " border-radius: 50%;\n",1007 " cursor: pointer;\n",1008 " display: none;\n",1009 " fill: #1967D2;\n",1010 " height: 32px;\n",1011 " padding: 0 0 0 0;\n",1012 " width: 32px;\n",1013 " }\n",1014 "\n",1015 " .colab-df-convert:hover {\n",1016 " background-color: #E2EBFA;\n",1017 " box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",1018 " fill: #174EA6;\n",1019 " }\n",1020 "\n",1021 " .colab-df-buttons div {\n",1022 " margin-bottom: 4px;\n",1023 " }\n",1024 "\n",1025 " [theme=dark] .colab-df-convert {\n",1026 " background-color: #3B4455;\n",1027 " fill: #D2E3FC;\n",1028 " }\n",1029 "\n",1030 " [theme=dark] .colab-df-convert:hover {\n",1031 " background-color: #434B5C;\n",1032 " box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",1033 " filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",1034 " fill: #FFFFFF;\n",1035 " }\n",1036 " </style>\n",1037 "\n",1038 " <script>\n",1039 " const buttonEl =\n",1040 " document.querySelector('#df-05c22ad4-7899-40ef-b2e3-9e8de90ac366 button.colab-df-convert');\n",1041 " buttonEl.style.display =\n",1042 " google.colab.kernel.accessAllowed ? 'block' : 'none';\n",1043 "\n",1044 " async function convertToInteractive(key) {\n",1045 " const element = document.querySelector('#df-05c22ad4-7899-40ef-b2e3-9e8de90ac366');\n",1046 " const dataTable =\n",1047 " await google.colab.kernel.invokeFunction('convertToInteractive',\n",1048 " [key], {});\n",1049 " if (!dataTable) return;\n",1050 "\n",1051 " const docLinkHtml = 'Like what you see? Visit the ' +\n",1052 " '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",1053 " + ' to learn more about interactive tables.';\n",1054 " element.innerHTML = '';\n",1055 " dataTable['output_type'] = 'display_data';\n",1056 " await google.colab.output.renderOutput(dataTable, element);\n",1057 " const docLink = document.createElement('div');\n",1058 " docLink.innerHTML = docLinkHtml;\n",1059 " element.appendChild(docLink);\n",1060 " }\n",1061 " </script>\n",1062 " </div>\n",1063 "\n",1064 "\n",1065 " </div>\n",1066 " </div>\n"1067 ],1068 "application/vnd.google.colaboratory.intrinsic+json": {1069 "type": "dataframe",1070 "summary": "{\n \"name\": \"quality_check(df_sales, \\\"df_sales\\\")\",\n \"rows\": 4,\n \"fields\": [\n {\n \"column\": \"count\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": \"18000\",\n \"max\": \"18000\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"18000\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"unique\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 3,\n \"max\": 999,\n \"num_unique_values\": 3,\n \"samples\": [\n 999\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"top\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 3,\n \"samples\": [\n \"The Star-Touched Queen\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"freq\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": \"36\",\n \"max\": \"7884\",\n \"num_unique_values\": 3,\n \"samples\": [\n \"36\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"mean\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 168.02416666666667,\n \"max\": 168.02416666666667,\n \"num_unique_values\": 1,\n \"samples\": [\n 168.02416666666667\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"std\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 98.65635350480927,\n \"max\": 98.65635350480927,\n \"num_unique_values\": 1,\n \"samples\": [\n 98.65635350480927\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"min\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 0.0,\n \"max\": 0.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 0.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"25%\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 84.0,\n \"max\": 84.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 84.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"50%\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 148.0,\n \"max\": 148.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 148.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"75%\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 262.0,\n \"max\": 262.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 262.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"max\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": 362.0,\n \"max\": 362.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 362.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"1071 }1072 },1073 "metadata": {}1074 },1075 {1076 "output_type": "stream",1077 "name": "stdout",1078 "text": [1079 "\n",1080 "๐ Sample Rows:\n"1081 ]1082 },1083 {1084 "output_type": "display_data",1085 "data": {1086 "text/plain": [1087 " title month units_sold \\\n",1088 "1459 Princess Between Worlds (Wide-Awake Princess #5) 2024-10 91 \n",1089 "17737 Deep Under (Walker Security #1) 2025-04 305 \n",1090 "2464 The Wedding Dress 2026-01 0 \n",1091 "7577 Without Shame 2026-02 268 \n",1092 "8663 Future Shock (Future Shock #1) 2025-02 263 \n",1093 "\n",1094 " sentiment_label \n",1095 "1459 neutral \n",1096 "17737 positive \n",1097 "2464 negative \n",1098 "7577 positive \n",1099 "8663 positive "1100 ],1101 "text/html": [1102 "\n",1103 " <div id=\"df-092fdd04-baf6-4dff-b185-cddf2c84efd8\" class=\"colab-df-container\">\n",1104 " <div>\n",1105 "<style scoped>\n",1106 " .dataframe tbody tr th:only-of-type {\n",1107 " vertical-align: middle;\n",1108 " }\n",1109 "\n",1110 " .dataframe tbody tr th {\n",1111 " vertical-align: top;\n",1112 " }\n",1113 "\n",1114 " .dataframe thead th {\n",1115 " text-align: right;\n",1116 " }\n",1117 "</style>\n",1118 "<table border=\"1\" class=\"dataframe\">\n",1119 " <thead>\n",1120 " <tr style=\"text-align: right;\">\n",1121 " <th></th>\n",1122 " <th>title</th>\n",1123 " <th>month</th>\n",1124 " <th>units_sold</th>\n",1125 " <th>sentiment_label</th>\n",1126 " </tr>\n",1127 " </thead>\n",1128 " <tbody>\n",1129 " <tr>\n",1130 " <th>1459</th>\n",1131 " <td>Princess Between Worlds (Wide-Awake Princess #5)</td>\n",1132 " <td>2024-10</td>\n",1133 " <td>91</td>\n",1134 " <td>neutral</td>\n",1135 " </tr>\n",1136 " <tr>\n",1137 " <th>17737</th>\n",1138 " <td>Deep Under (Walker Security #1)</td>\n",1139 " <td>2025-04</td>\n",1140 " <td>305</td>\n",1141 " <td>positive</td>\n",1142 " </tr>\n",1143 " <tr>\n",1144 " <th>2464</th>\n",1145 " <td>The Wedding Dress</td>\n",1146 " <td>2026-01</td>\n",1147 " <td>0</td>\n",1148 " <td>negative</td>\n",1149 " </tr>\n",1150 " <tr>\n",1151 " <th>7577</th>\n",1152 " <td>Without Shame</td>\n",1153 " <td>2026-02</td>\n",1154 " <td>268</td>\n",1155 " <td>positive</td>\n",1156 " </tr>\n",1157 " <tr>\n",1158 " <th>8663</th>\n",1159 " <td>Future Shock (Future Shock #1)</td>\n",1160 " <td>2025-02</td>\n",1161 " <td>263</td>\n",1162 " <td>positive</td>\n",1163 " </tr>\n",1164 " </tbody>\n",1165 "</table>\n",1166 "</div>\n",1167 " <div class=\"colab-df-buttons\">\n",1168 "\n",1169 " <div class=\"colab-df-container\">\n",1170 " <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-092fdd04-baf6-4dff-b185-cddf2c84efd8')\"\n",1171 " title=\"Convert this dataframe to an interactive table.\"\n",1172 " style=\"display:none;\">\n",1173 "\n",1174 " <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",1175 " <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",1176 " </svg>\n",1177 " </button>\n",1178 "\n",1179 " <style>\n",1180 " .colab-df-container {\n",1181 " display:flex;\n",1182 " gap: 12px;\n",1183 " }\n",1184 "\n",1185 " .colab-df-convert {\n",1186 " background-color: #E8F0FE;\n",1187 " border: none;\n",1188 " border-radius: 50%;\n",1189 " cursor: pointer;\n",1190 " display: none;\n",1191 " fill: #1967D2;\n",1192 " height: 32px;\n",1193 " padding: 0 0 0 0;\n",1194 " width: 32px;\n",1195 " }\n",1196 "\n",1197 " .colab-df-convert:hover {\n",1198 " background-color: #E2EBFA;\n",1199 " box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",1200 " fill: #174EA6;\n",