Decoder2704/python-chatbot-jay
0
1{2 "cells": [3 {4 "cell_type": "code",5 "execution_count": 1,6 "id": "499c780e",7 "metadata": {8 "colab": {9 "base_uri": "https://localhost:8080/",10 "height": 38311 },12 "executionInfo": {13 "elapsed": 184,14 "status": "error",15 "timestamp": 1698432323410,16 "user": {17 "displayName": "Jay Paun",18 "userId": "02230944815040819432"19 },20 "user_tz": 24021 },22 "id": "499c780e",23 "outputId": "53a192d4-5a16-4546-ce6b-ae7da4b2fee1"24 },25 "outputs": [],26 "source": [27 "# Load data preprocessing libs\n",28 "import pandas as pd # dataset\n",29 "import numpy as np # maths\n",30 "from datetime import datetime,date # date time lib\n",31 "\n",32 "import re\n",33 "from bs4 import BeautifulSoup # removing html tags\n",34 "\n",35 "# Load vectorizer and similarity measure\n",36 "from sklearn.feature_extraction.text import TfidfVectorizer # term freq inverse doc. freq.\n",37 "from sklearn.metrics.pairwise import cosine_similarity # measuring the similarity of text\n",38 "\n",39 "import tkinter # User interface\n",40 "import threading\n",41 "from tkinter import *\n",42 "from tkinter import messagebox\n",43 "import speech_recognition as speech # taking input through voice\n",44 "import import_ipynb\n",45 "# from mailing import mail"46 ]47 },48 {49 "cell_type": "code",50 "execution_count": 2,51 "id": "9310b1f3",52 "metadata": {53 "colab": {54 "base_uri": "https://localhost:8080/",55 "height": 33856 },57 "executionInfo": {58 "elapsed": 13,59 "status": "error",60 "timestamp": 1698432323604,61 "user": {62 "displayName": "Jay Paun",63 "userId": "02230944815040819432"64 },65 "user_tz": 24066 },67 "id": "9310b1f3",68 "outputId": "428ae36a-ab9b-4f8b-f97f-b17d8ff95e7b"69 },70 "outputs": [],71 "source": [72 "q = pd.read_csv(\"Dataset/Questions.csv\",encoding='latin-1')\n",73 "an = pd.read_csv(\"Dataset/AnswersV2.csv\",encoding='latin-1')"74 ]75 },76 {77 "cell_type": "code",78 "execution_count": 5,79 "id": "db9204e4",80 "metadata": {},81 "outputs": [82 {83 "name": "stdout",84 "output_type": "stream",85 "text": [86 "607282\n"87 ]88 }89 ],90 "source": [91 "print(len(q.index))"92 ]93 },94 {95 "cell_type": "code",96 "execution_count": 3,97 "id": "cd50d5b2",98 "metadata": {99 "executionInfo": {100 "elapsed": 10,101 "status": "aborted",102 "timestamp": 1698432323604,103 "user": {104 "displayName": "Jay Paun",105 "userId": "02230944815040819432"106 },107 "user_tz": 240108 },109 "id": "cd50d5b2"110 },111 "outputs": [112 {113 "data": {114 "text/html": [115 "<div>\n",116 "<style scoped>\n",117 " .dataframe tbody tr th:only-of-type {\n",118 " vertical-align: middle;\n",119 " }\n",120 "\n",121 " .dataframe tbody tr th {\n",122 " vertical-align: top;\n",123 " }\n",124 "\n",125 " .dataframe thead th {\n",126 " text-align: right;\n",127 " }\n",128 "</style>\n",129 "<table border=\"1\" class=\"dataframe\">\n",130 " <thead>\n",131 " <tr style=\"text-align: right;\">\n",132 " <th></th>\n",133 " <th>Id</th>\n",134 " <th>OwnerUserId</th>\n",135 " <th>CreationDate</th>\n",136 " <th>ParentId</th>\n",137 " <th>Score</th>\n",138 " <th>Body</th>\n",139 " <th>latest_score</th>\n",140 " <th>alternate</th>\n",141 " <th>date</th>\n",142 " </tr>\n",143 " </thead>\n",144 " <tbody>\n",145 " <tr>\n",146 " <th>0</th>\n",147 " <td>497</td>\n",148 " <td>50.0</td>\n",149 " <td>2008-08-02T16:56:53Z</td>\n",150 " <td>469</td>\n",151 " <td>4</td>\n",152 " <td><p>open up a terminal (Applications-&gt;Utilit...</td>\n",153 " <td>4</td>\n",154 " <td>4</td>\n",155 " <td>2024-02-14</td>\n",156 " </tr>\n",157 " <tr>\n",158 " <th>1</th>\n",159 " <td>518</td>\n",160 " <td>153.0</td>\n",161 " <td>2008-08-02T17:42:28Z</td>\n",162 " <td>469</td>\n",163 " <td>2</td>\n",164 " <td><p>I haven't been able to find anything that d...</td>\n",165 " <td>2</td>\n",166 " <td>2</td>\n",167 " <td>2024-02-14</td>\n",168 " </tr>\n",169 " <tr>\n",170 " <th>2</th>\n",171 " <td>536</td>\n",172 " <td>161.0</td>\n",173 " <td>2008-08-02T18:49:07Z</td>\n",174 " <td>502</td>\n",175 " <td>9</td>\n",176 " <td><p>You can use ImageMagick's convert utility f...</td>\n",177 " <td>9</td>\n",178 " <td>9</td>\n",179 " <td>2024-02-14</td>\n",180 " </tr>\n",181 " <tr>\n",182 " <th>3</th>\n",183 " <td>538</td>\n",184 " <td>156.0</td>\n",185 " <td>2008-08-02T18:56:56Z</td>\n",186 " <td>535</td>\n",187 " <td>23</td>\n",188 " <td><p>One possibility is Hudson. It's written in...</td>\n",189 " <td>23</td>\n",190 " <td>23</td>\n",191 " <td>2024-02-14</td>\n",192 " </tr>\n",193 " <tr>\n",194 " <th>4</th>\n",195 " <td>541</td>\n",196 " <td>157.0</td>\n",197 " <td>2008-08-02T19:06:40Z</td>\n",198 " <td>535</td>\n",199 " <td>20</td>\n",200 " <td><p>We run <a href=\"http://buildbot.net/trac\">B...</td>\n",201 " <td>20</td>\n",202 " <td>20</td>\n",203 " <td>2024-02-14</td>\n",204 " </tr>\n",205 " </tbody>\n",206 "</table>\n",207 "</div>"208 ],209 "text/plain": [210 " Id OwnerUserId CreationDate ParentId Score \\\n",211 "0 497 50.0 2008-08-02T16:56:53Z 469 4 \n",212 "1 518 153.0 2008-08-02T17:42:28Z 469 2 \n",213 "2 536 161.0 2008-08-02T18:49:07Z 502 9 \n",214 "3 538 156.0 2008-08-02T18:56:56Z 535 23 \n",215 "4 541 157.0 2008-08-02T19:06:40Z 535 20 \n",216 "\n",217 " Body latest_score alternate \\\n",218 "0 <p>open up a terminal (Applications->Utilit... 4 4 \n",219 "1 <p>I haven't been able to find anything that d... 2 2 \n",220 "2 <p>You can use ImageMagick's convert utility f... 9 9 \n",221 "3 <p>One possibility is Hudson. It's written in... 23 23 \n",222 "4 <p>We run <a href=\"http://buildbot.net/trac\">B... 20 20 \n",223 "\n",224 " date \n",225 "0 2024-02-14 \n",226 "1 2024-02-14 \n",227 "2 2024-02-14 \n",228 "3 2024-02-14 \n",229 "4 2024-02-14 "230 ]231 },232 "execution_count": 3,233 "metadata": {},234 "output_type": "execute_result"235 }236 ],237 "source": [238 "an.head()"239 ]240 },241 {242 "cell_type": "code",243 "execution_count": 4,244 "id": "e6294c92",245 "metadata": {246 "executionInfo": {247 "elapsed": 10,248 "status": "aborted",249 "timestamp": 1698432323605,250 "user": {251 "displayName": "Jay Paun",252 "userId": "02230944815040819432"253 },254 "user_tz": 240255 },256 "id": "e6294c92"257 },258 "outputs": [259 {260 "data": {261 "text/html": [262 "<div>\n",263 "<style scoped>\n",264 " .dataframe tbody tr th:only-of-type {\n",265 " vertical-align: middle;\n",266 " }\n",267 "\n",268 " .dataframe tbody tr th {\n",269 " vertical-align: top;\n",270 " }\n",271 "\n",272 " .dataframe thead th {\n",273 " text-align: right;\n",274 " }\n",275 "</style>\n",276 "<table border=\"1\" class=\"dataframe\">\n",277 " <thead>\n",278 " <tr style=\"text-align: right;\">\n",279 " <th></th>\n",280 " <th>Id</th>\n",281 " <th>OwnerUserId</th>\n",282 " <th>CreationDate</th>\n",283 " <th>QId</th>\n",284 " <th>Score</th>\n",285 " <th>Body</th>\n",286 " <th>latest_score</th>\n",287 " <th>alternate</th>\n",288 " <th>date</th>\n",289 " </tr>\n",290 " </thead>\n",291 " <tbody>\n",292 " <tr>\n",293 " <th>0</th>\n",294 " <td>497</td>\n",295 " <td>50.0</td>\n",296 " <td>2008-08-02T16:56:53Z</td>\n",297 " <td>469</td>\n",298 " <td>4</td>\n",299 " <td><p>open up a terminal (Applications-&gt;Utilit...</td>\n",300 " <td>4</td>\n",301 " <td>4</td>\n",302 " <td>2024-02-14</td>\n",303 " </tr>\n",304 " <tr>\n",305 " <th>1</th>\n",306 " <td>518</td>\n",307 " <td>153.0</td>\n",308 " <td>2008-08-02T17:42:28Z</td>\n",309 " <td>469</td>\n",310 " <td>2</td>\n",311 " <td><p>I haven't been able to find anything that d...</td>\n",312 " <td>2</td>\n",313 " <td>2</td>\n",314 " <td>2024-02-14</td>\n",315 " </tr>\n",316 " <tr>\n",317 " <th>2</th>\n",318 " <td>536</td>\n",319 " <td>161.0</td>\n",320 " <td>2008-08-02T18:49:07Z</td>\n",321 " <td>502</td>\n",322 " <td>9</td>\n",323 " <td><p>You can use ImageMagick's convert utility f...</td>\n",324 " <td>9</td>\n",325 " <td>9</td>\n",326 " <td>2024-02-14</td>\n",327 " </tr>\n",328 " <tr>\n",329 " <th>3</th>\n",330 " <td>538</td>\n",331 " <td>156.0</td>\n",332 " <td>2008-08-02T18:56:56Z</td>\n",333 " <td>535</td>\n",334 " <td>23</td>\n",335 " <td><p>One possibility is Hudson. It's written in...</td>\n",336 " <td>23</td>\n",337 " <td>23</td>\n",338 " <td>2024-02-14</td>\n",339 " </tr>\n",340 " <tr>\n",341 " <th>4</th>\n",342 " <td>541</td>\n",343 " <td>157.0</td>\n",344 " <td>2008-08-02T19:06:40Z</td>\n",345 " <td>535</td>\n",346 " <td>20</td>\n",347 " <td><p>We run <a href=\"http://buildbot.net/trac\">B...</td>\n",348 " <td>20</td>\n",349 " <td>20</td>\n",350 " <td>2024-02-14</td>\n",351 " </tr>\n",352 " </tbody>\n",353 "</table>\n",354 "</div>"355 ],356 "text/plain": [357 " Id OwnerUserId CreationDate QId Score \\\n",358 "0 497 50.0 2008-08-02T16:56:53Z 469 4 \n",359 "1 518 153.0 2008-08-02T17:42:28Z 469 2 \n",360 "2 536 161.0 2008-08-02T18:49:07Z 502 9 \n",361 "3 538 156.0 2008-08-02T18:56:56Z 535 23 \n",362 "4 541 157.0 2008-08-02T19:06:40Z 535 20 \n",363 "\n",364 " Body latest_score alternate \\\n",365 "0 <p>open up a terminal (Applications->Utilit... 4 4 \n",366 "1 <p>I haven't been able to find anything that d... 2 2 \n",367 "2 <p>You can use ImageMagick's convert utility f... 9 9 \n",368 "3 <p>One possibility is Hudson. It's written in... 23 23 \n",369 "4 <p>We run <a href=\"http://buildbot.net/trac\">B... 20 20 \n",370 "\n",371 " date \n",372 "0 2024-02-14 \n",373 "1 2024-02-14 \n",374 "2 2024-02-14 \n",375 "3 2024-02-14 \n",376 "4 2024-02-14 "377 ]378 },379 "execution_count": 4,380 "metadata": {},381 "output_type": "execute_result"382 }383 ],384 "source": [385 "an.rename(columns={'ParentId':'QId'},inplace=True)\n",386 "an.head()"387 ]388 },389 {390 "cell_type": "code",391 "execution_count": 5,392 "id": "3c3a7943",393 "metadata": {394 "executionInfo": {395 "elapsed": 10,396 "status": "aborted",397 "timestamp": 1698432323606,398 "user": {399 "displayName": "Jay Paun",400 "userId": "02230944815040819432"401 },402 "user_tz": 240403 },404 "id": "3c3a7943"405 },406 "outputs": [],407 "source": [408 "q.rename(columns={'Id':'QId'},inplace=True)\n",409 "an.rename(columns={'Id':'AId'},inplace=True)"410 ]411 },412 {413 "cell_type": "code",414 "execution_count": 6,415 "id": "fb0c57ac",416 "metadata": {417 "executionInfo": {418 "elapsed": 510,419 "status": "aborted",420 "timestamp": 1698432323606,421 "user": {422 "displayName": "Jay Paun",423 "userId": "02230944815040819432"424 },425 "user_tz": 240426 },427 "id": "fb0c57ac"428 },429 "outputs": [430 {431 "data": {432 "text/html": [433 "<div>\n",434 "<style scoped>\n",435 " .dataframe tbody tr th:only-of-type {\n",436 " vertical-align: middle;\n",437 " }\n",438 "\n",439 " .dataframe tbody tr th {\n",440 " vertical-align: top;\n",441 " }\n",442 "\n",443 " .dataframe thead th {\n",444 " text-align: right;\n",445 " }\n",446 "</style>\n",447 "<table border=\"1\" class=\"dataframe\">\n",448 " <thead>\n",449 " <tr style=\"text-align: right;\">\n",450 " <th></th>\n",451 " <th>AId</th>\n",452 " <th>OwnerUserId</th>\n",453 " <th>CreationDate</th>\n",454 " <th>QId</th>\n",455 " <th>Score</th>\n",456 " <th>Body</th>\n",457 " <th>latest_score</th>\n",458 " <th>alternate</th>\n",459 " <th>date</th>\n",460 " </tr>\n",461 " </thead>\n",462 " <tbody>\n",463 " <tr>\n",464 " <th>2</th>\n",465 " <td>536</td>\n",466 " <td>161.0</td>\n",467 " <td>2008-08-02T18:49:07Z</td>\n",468 " <td>502</td>\n",469 " <td>9</td>\n",470 " <td><p>You can use ImageMagick's convert utility f...</td>\n",471 " <td>9</td>\n",472 " <td>9</td>\n",473 " <td>2024-02-14</td>\n",474 " </tr>\n",475 " <tr>\n",476 " <th>3</th>\n",477 " <td>538</td>\n",478 " <td>156.0</td>\n",479 " <td>2008-08-02T18:56:56Z</td>\n",480 " <td>535</td>\n",481 " <td>23</td>\n",482 " <td><p>One possibility is Hudson. It's written in...</td>\n",483 " <td>23</td>\n",484 " <td>23</td>\n",485 " <td>2024-02-14</td>\n",486 " </tr>\n",487 " <tr>\n",488 " <th>4</th>\n",489 " <td>541</td>\n",490 " <td>157.0</td>\n",491 " <td>2008-08-02T19:06:40Z</td>\n",492 " <td>535</td>\n",493 " <td>20</td>\n",494 " <td><p>We run <a href=\"http://buildbot.net/trac\">B...</td>\n",495 " <td>20</td>\n",496 " <td>20</td>\n",497 " <td>2024-02-14</td>\n",498 " </tr>\n",499 " <tr>\n",500 " <th>5</th>\n",501 " <td>595</td>\n",502 " <td>116.0</td>\n",503 " <td>2008-08-03T01:17:36Z</td>\n",504 " <td>594</td>\n",505 " <td>25</td>\n",506 " <td><p>The canonical way is to use the built-in cu...</td>\n",507 " <td>25</td>\n",508 " <td>25</td>\n",509 " <td>2024-02-14</td>\n",510 " </tr>\n",511 " <tr>\n",512 " <th>6</th>\n",513 " <td>660</td>\n",514 " <td>197.0</td>\n",515 " <td>2008-08-03T12:09:18Z</td>\n",516 " <td>535</td>\n",517 " <td>14</td>\n",518 " <td><p>Second the Buildbot - Trac integration. You...</td>\n",519 " <td>14</td>\n",520 " <td>14</td>\n",521 " <td>2024-02-14</td>\n",522 " </tr>\n",523 " </tbody>\n",524 "</table>\n",525 "</div>"526 ],527 "text/plain": [528 " AId OwnerUserId CreationDate QId Score \\\n",529 "2 536 161.0 2008-08-02T18:49:07Z 502 9 \n",530 "3 538 156.0 2008-08-02T18:56:56Z 535 23 \n",531 "4 541 157.0 2008-08-02T19:06:40Z 535 20 \n",532 "5 595 116.0 2008-08-03T01:17:36Z 594 25 \n",533 "6 660 197.0 2008-08-03T12:09:18Z 535 14 \n",534 "\n",535 " Body latest_score alternate \\\n",536 "2 <p>You can use ImageMagick's convert utility f... 9 9 \n",537 "3 <p>One possibility is Hudson. It's written in... 23 23 \n",538 "4 <p>We run <a href=\"http://buildbot.net/trac\">B... 20 20 \n",539 "5 <p>The canonical way is to use the built-in cu... 25 25 \n",540 "6 <p>Second the Buildbot - Trac integration. You... 14 14 \n",541 "\n",542 " date \n",543 "2 2024-02-14 \n",544 "3 2024-02-14 \n",545 "4 2024-02-14 \n",546 "5 2024-02-14 \n",547 "6 2024-02-14 "548 ]549 },550 "execution_count": 6,551 "metadata": {},552 "output_type": "execute_result"553 }554 ],555 "source": [556 "an = an[an['Score']>5]\n",557 "an.head()"558 ]559 },560 {561 "cell_type": "code",562 "execution_count": 7,563 "id": "2105797a",564 "metadata": {565 "executionInfo": {566 "elapsed": 13,567 "status": "aborted",568 "timestamp": 1698432323803,569 "user": {570 "displayName": "Jay Paun",571 "userId": "02230944815040819432"572 },573 "user_tz": 240574 },575 "id": "2105797a"576 },577 "outputs": [578 {579 "data": {580 "text/html": [581 "<div>\n",582 "<style scoped>\n",583 " .dataframe tbody tr th:only-of-type {\n",584 " vertical-align: middle;\n",585 " }\n",586 "\n",587 " .dataframe tbody tr th {\n",588 " vertical-align: top;\n",589 " }\n",590 "\n",591 " .dataframe thead th {\n",592 " text-align: right;\n",593 " }\n",594 "</style>\n",595 "<table border=\"1\" class=\"dataframe\">\n",596 " <thead>\n",597 " <tr style=\"text-align: right;\">\n",598 " <th></th>\n",599 " <th>QId</th>\n",600 " <th>OwnerUserId</th>\n",601 " <th>CreationDate</th>\n",602 " <th>Score</th>\n",603 " <th>Title</th>\n",604 " <th>Body</th>\n",605 " </tr>\n",606 " </thead>\n",607 " <tbody>\n",608 " <tr>\n",609 " <th>0</th>\n",610 " <td>469</td>\n",611 " <td>147.0</td>\n",612 " <td>2008-08-02T15:11:16Z</td>\n",613 " <td>21</td>\n",614 " <td>How can I find the full path to a font from it...</td>\n",615 " <td><p>I am using the Photoshop's javascript API t...</td>\n",616 " </tr>\n",617 " <tr>\n",618 " <th>1</th>\n",619 " <td>502</td>\n",620 " <td>147.0</td>\n",621 " <td>2008-08-02T17:01:58Z</td>\n",622 " <td>27</td>\n",623 " <td>Get a preview JPEG of a PDF on Windows?</td>\n",624 " <td><p>I have a cross-platform (Python) applicatio...</td>\n",625 " </tr>\n",626 " <tr>\n",627 " <th>2</th>\n",628 " <td>535</td>\n",629 " <td>154.0</td>\n",630 " <td>2008-08-02T18:43:54Z</td>\n",631 " <td>40</td>\n",632 " <td>Continuous Integration System for a Python Cod...</td>\n",633 " <td><p>I'm starting work on a hobby project with a...</td>\n",634 " </tr>\n",635 " <tr>\n",636 " <th>3</th>\n",637 " <td>594</td>\n",638 " <td>116.0</td>\n",639 " <td>2008-08-03T01:15:08Z</td>\n",640 " <td>25</td>\n",641 " <td>cx_Oracle: How do I iterate over a result set?</td>\n",642 " <td><p>There are several ways to iterate over a re...</td>\n",643 " </tr>\n",644 " <tr>\n",645 " <th>4</th>\n",646 " <td>683</td>\n",647 " <td>199.0</td>\n",648 " <td>2008-08-03T13:19:16Z</td>\n",649 " <td>28</td>\n",650 " <td>Using 'in' to match an attribute of Python obj...</td>\n",651 " <td><p>I don't remember whether I was dreaming or ...</td>\n",652 " </tr>\n",653 " </tbody>\n",654 "</table>\n",655 "</div>"656 ],657 "text/plain": [658 " QId OwnerUserId CreationDate Score \\\n",659 "0 469 147.0 2008-08-02T15:11:16Z 21 \n",660 "1 502 147.0 2008-08-02T17:01:58Z 27 \n",661 "2 535 154.0 2008-08-02T18:43:54Z 40 \n",662 "3 594 116.0 2008-08-03T01:15:08Z 25 \n",663 "4 683 199.0 2008-08-03T13:19:16Z 28 \n",664 "\n",665 " Title \\\n",666 "0 How can I find the full path to a font from it... \n",667 "1 Get a preview JPEG of a PDF on Windows? \n",668 "2 Continuous Integration System for a Python Cod... \n",669 "3 cx_Oracle: How do I iterate over a result set? \n",670 "4 Using 'in' to match an attribute of Python obj... \n",671 "\n",672 " Body \n",673 "0 <p>I am using the Photoshop's javascript API t... \n",674 "1 <p>I have a cross-platform (Python) applicatio... \n",675 "2 <p>I'm starting work on a hobby project with a... \n",676 "3 <p>There are several ways to iterate over a re... \n",677 "4 <p>I don't remember whether I was dreaming or ... "678 ]679 },680 "execution_count": 7,681 "metadata": {},682 "output_type": "execute_result"683 }684 ],685 "source": [686 "q.head()"687 ]688 },689 {690 "cell_type": "code",691 "execution_count": 8,692 "id": "ea1f8452",693 "metadata": {694 "executionInfo": {695 "elapsed": 13,696 "status": "aborted",697 "timestamp": 1698432323803,698 "user": {699 "displayName": "Jay Paun",700 "userId": "02230944815040819432"701 },702 "user_tz": 240703 },704 "id": "ea1f8452"705 },706 "outputs": [707 {708 "data": {709 "text/html": [710 "<div>\n",711 "<style scoped>\n",712 " .dataframe tbody tr th:only-of-type {\n",713 " vertical-align: middle;\n",714 " }\n",715 "\n",716 " .dataframe tbody tr th {\n",717 " vertical-align: top;\n",718 " }\n",719 "\n",720 " .dataframe thead th {\n",721 " text-align: right;\n",722 " }\n",723 "</style>\n",724 "<table border=\"1\" class=\"dataframe\">\n",725 " <thead>\n",726 " <tr style=\"text-align: right;\">\n",727 " <th></th>\n",728 " <th>QId</th>\n",729 " <th>OwnerUserId_x</th>\n",730 " <th>CreationDate_x</th>\n",731 " <th>Score_x</th>\n",732 " <th>Title</th>\n",733 " <th>Body_x</th>\n",734 " <th>AId</th>\n",735 " <th>OwnerUserId_y</th>\n",736 " <th>CreationDate_y</th>\n",737 " <th>Score_y</th>\n",738 " <th>Body_y</th>\n",739 " <th>latest_score</th>\n",740 " <th>alternate</th>\n",741 " <th>date</th>\n",742 " </tr>\n",743 " </thead>\n",744 " <tbody>\n",745 " <tr>\n",746 " <th>0</th>\n",747 " <td>469</td>\n",748 " <td>147.0</td>\n",749 " <td>2008-08-02T15:11:16Z</td>\n",750 " <td>21</td>\n",751 " <td>How can I find the full path to a font from it...</td>\n",752 " <td><p>I am using the Photoshop's javascript API t...</td>\n",753 " <td>3040</td>\n",754 " <td>457.0</td>\n",755 " <td>2008-08-06T03:01:23Z</td>\n",756 " <td>12</td>\n",757 " <td><p>Unfortunately the only API that isn't depre...</td>\n",758 " <td>12</td>\n",759 " <td>12</td>\n",760 " <td>2024-02-14</td>\n",761 " </tr>\n",762 " <tr>\n",763 " <th>1</th>\n",764 " <td>502</td>\n",765 " <td>147.0</td>\n",766 " <td>2008-08-02T17:01:58Z</td>\n",767 " <td>27</td>\n",768 " <td>Get a preview JPEG of a PDF on Windows?</td>\n",769 " <td><p>I have a cross-platform (Python) applicatio...</td>\n",770 " <td>536</td>\n",771 " <td>161.0</td>\n",772 " <td>2008-08-02T18:49:07Z</td>\n",773 " <td>9</td>\n",774 " <td><p>You can use ImageMagick's convert utility f...</td>\n",775 " <td>9</td>\n",776 " <td>9</td>\n",777 " <td>2024-02-14</td>\n",778 " </tr>\n",779 " <tr>\n",780 " <th>2</th>\n",781 " <td>502</td>\n",782 " <td>147.0</td>\n",783 " <td>2008-08-02T17:01:58Z</td>\n",784 " <td>27</td>\n",785 " <td>Get a preview JPEG of a PDF on Windows?</td>\n",786 " <td><p>I have a cross-platform (Python) applicatio...</td>\n",787 " <td>7090</td>\n",788 " <td>13.0</td>\n",789 " <td>2008-08-10T08:08:33Z</td>\n",790 " <td>25</td>\n",791 " <td><p>ImageMagick delegates the PDF->bitmap conve...</td>\n",792 " <td>25</td>\n",793 " <td>25</td>\n",794 " <td>2024-02-14</td>\n",795 " </tr>\n",796 " <tr>\n",797 " <th>3</th>\n",798 " <td>535</td>\n",799 " <td>154.0</td>\n",800 " <td>2008-08-02T18:43:54Z</td>\n",801 " <td>40</td>\n",802 " <td>Continuous Integration System for a Python Cod...</td>\n",803 " <td><p>I'm starting work on a hobby project with a...</td>\n",804 " <td>538</td>\n",805 " <td>156.0</td>\n",806 " <td>2008-08-02T18:56:56Z</td>\n",807 " <td>23</td>\n",808 " <td><p>One possibility is Hudson. It's written in...</td>\n",809 " <td>23</td>\n",810 " <td>23</td>\n",811 " <td>2024-02-14</td>\n",812 " </tr>\n",813 " <tr>\n",814 " <th>4</th>\n",815 " <td>535</td>\n",816 " <td>154.0</td>\n",817 " <td>2008-08-02T18:43:54Z</td>\n",818 " <td>40</td>\n",819 " <td>Continuous Integration System for a Python Cod...</td>\n",820 " <td><p>I'm starting work on a hobby project with a...</td>\n",821 " <td>541</td>\n",822 " <td>157.0</td>\n",823 " <td>2008-08-02T19:06:40Z</td>\n",824 " <td>20</td>\n",825 " <td><p>We run <a href=\"http://buildbot.net/trac\">B...</td>\n",826 " <td>20</td>\n",827 " <td>20</td>\n",828 " <td>2024-02-14</td>\n",829 " </tr>\n",830 " </tbody>\n",831 "</table>\n",832 "</div>"833 ],834 "text/plain": [835 " QId OwnerUserId_x CreationDate_x Score_x \\\n",836 "0 469 147.0 2008-08-02T15:11:16Z 21 \n",837 "1 502 147.0 2008-08-02T17:01:58Z 27 \n",838 "2 502 147.0 2008-08-02T17:01:58Z 27 \n",839 "3 535 154.0 2008-08-02T18:43:54Z 40 \n",840 "4 535 154.0 2008-08-02T18:43:54Z 40 \n",841 "\n",842 " Title \\\n",843 "0 How can I find the full path to a font from it... \n",844 "1 Get a preview JPEG of a PDF on Windows? \n",845 "2 Get a preview JPEG of a PDF on Windows? \n",846 "3 Continuous Integration System for a Python Cod... \n",847 "4 Continuous Integration System for a Python Cod... \n",848 "\n",849 " Body_x AId OwnerUserId_y \\\n",850 "0 <p>I am using the Photoshop's javascript API t... 3040 457.0 \n",851 "1 <p>I have a cross-platform (Python) applicatio... 536 161.0 \n",852 "2 <p>I have a cross-platform (Python) applicatio... 7090 13.0 \n",853 "3 <p>I'm starting work on a hobby project with a... 538 156.0 \n",854 "4 <p>I'm starting work on a hobby project with a... 541 157.0 \n",855 "\n",856 " CreationDate_y Score_y \\\n",857 "0 2008-08-06T03:01:23Z 12 \n",858 "1 2008-08-02T18:49:07Z 9 \n",859 "2 2008-08-10T08:08:33Z 25 \n",860 "3 2008-08-02T18:56:56Z 23 \n",861 "4 2008-08-02T19:06:40Z 20 \n",862 "\n",863 " Body_y latest_score alternate \\\n",864 "0 <p>Unfortunately the only API that isn't depre... 12 12 \n",865 "1 <p>You can use ImageMagick's convert utility f... 9 9 \n",866 "2 <p>ImageMagick delegates the PDF->bitmap conve... 25 25 \n",867 "3 <p>One possibility is Hudson. It's written in... 23 23 \n",868 "4 <p>We run <a href=\"http://buildbot.net/trac\">B... 20 20 \n",869 "\n",870 " date \n",871 "0 2024-02-14 \n",872 "1 2024-02-14 \n",873 "2 2024-02-14 \n",874 "3 2024-02-14 \n",875 "4 2024-02-14 "876 ]877 },878 "execution_count": 8,879 "metadata": {},880 "output_type": "execute_result"881 }882 ],883 "source": [884 "df = q.merge(an, on='QId')\n",885 "df.head()"886 ]887 },888 {889 "cell_type": "code",890 "execution_count": 9,891 "id": "56a5a410",892 "metadata": {893 "executionInfo": {894 "elapsed": 13,895 "status": "aborted",896 "timestamp": 1698432323803,897 "user": {898 "displayName": "Jay Paun",899 "userId": "02230944815040819432"900 },901 "user_tz": 240902 },903 "id": "56a5a410"904 },905 "outputs": [906 {907 "data": {908 "text/html": [909 "<div>\n",910 "<style scoped>\n",911 " .dataframe tbody tr th:only-of-type {\n",912 " vertical-align: middle;\n",913 " }\n",914 "\n",915 " .dataframe tbody tr th {\n",916 " vertical-align: top;\n",917 " }\n",918 "\n",919 " .dataframe thead th {\n",920 " text-align: right;\n",921 " }\n",922 "</style>\n",923 "<table border=\"1\" class=\"dataframe\">\n",924 " <thead>\n",925 " <tr style=\"text-align: right;\">\n",926 " <th></th>\n",927 " <th>QId</th>\n",928 " <th>Title</th>\n",929 " <th>Body_x</th>\n",930 " <th>AId</th>\n",931 " <th>Score_y</th>\n",932 " <th>Body_y</th>\n",933 " <th>latest_score</th>\n",934 " <th>alternate</th>\n",935 " <th>date</th>\n",936 " </tr>\n",937 " </thead>\n",938 " <tbody>\n",939 " <tr>\n",940 " <th>0</th>\n",941 " <td>469</td>\n",942 " <td>How can I find the full path to a font from it...</td>\n",943 " <td><p>I am using the Photoshop's javascript API t...</td>\n",944 " <td>3040</td>\n",945 " <td>12</td>\n",946 " <td><p>Unfortunately the only API that isn't depre...</td>\n",947 " <td>12</td>\n",948 " <td>12</td>\n",949 " <td>2024-02-14</td>\n",950 " </tr>\n",951 " <tr>\n",952 " <th>1</th>\n",953 " <td>502</td>\n",954 " <td>Get a preview JPEG of a PDF on Windows?</td>\n",955 " <td><p>I have a cross-platform (Python) applicatio...</td>\n",956 " <td>536</td>\n",957 " <td>9</td>\n",958 " <td><p>You can use ImageMagick's convert utility f...</td>\n",959 " <td>9</td>\n",960 " <td>9</td>\n",961 " <td>2024-02-14</td>\n",962 " </tr>\n",963 " <tr>\n",964 " <th>2</th>\n",965 " <td>502</td>\n",966 " <td>Get a preview JPEG of a PDF on Windows?</td>\n",967 " <td><p>I have a cross-platform (Python) applicatio...</td>\n",968 " <td>7090</td>\n",969 " <td>25</td>\n",970 " <td><p>ImageMagick delegates the PDF->bitmap conve...</td>\n",971 " <td>25</td>\n",972 " <td>25</td>\n",973 " <td>2024-02-14</td>\n",974 " </tr>\n",975 " <tr>\n",976 " <th>3</th>\n",977 " <td>535</td>\n",978 " <td>Continuous Integration System for a Python Cod...</td>\n",979 " <td><p>I'm starting work on a hobby project with a...</td>\n",980 " <td>538</td>\n",981 " <td>23</td>\n",982 " <td><p>One possibility is Hudson. It's written in...</td>\n",983 " <td>23</td>\n",984 " <td>23</td>\n",985 " <td>2024-02-14</td>\n",986 " </tr>\n",987 " <tr>\n",988 " <th>4</th>\n",989 " <td>535</td>\n",990 " <td>Continuous Integration System for a Python Cod...</td>\n",991 " <td><p>I'm starting work on a hobby project with a...</td>\n",992 " <td>541</td>\n",993 " <td>20</td>\n",994 " <td><p>We run <a href=\"http://buildbot.net/trac\">B...</td>\n",995 " <td>20</td>\n",996 " <td>20</td>\n",997 " <td>2024-02-14</td>\n",998 " </tr>\n",999 " </tbody>\n",1000 "</table>\n",1001 "</div>"1002 ],1003 "text/plain": [1004 " QId Title \\\n",1005 "0 469 How can I find the full path to a font from it... \n",1006 "1 502 Get a preview JPEG of a PDF on Windows? \n",1007 "2 502 Get a preview JPEG of a PDF on Windows? \n",1008 "3 535 Continuous Integration System for a Python Cod... \n",1009 "4 535 Continuous Integration System for a Python Cod... \n",1010 "\n",1011 " Body_x AId Score_y \\\n",1012 "0 <p>I am using the Photoshop's javascript API t... 3040 12 \n",1013 "1 <p>I have a cross-platform (Python) applicatio... 536 9 \n",1014 "2 <p>I have a cross-platform (Python) applicatio... 7090 25 \n",1015 "3 <p>I'm starting work on a hobby project with a... 538 23 \n",1016 "4 <p>I'm starting work on a hobby project with a... 541 20 \n",1017 "\n",1018 " Body_y latest_score alternate \\\n",1019 "0 <p>Unfortunately the only API that isn't depre... 12 12 \n",1020 "1 <p>You can use ImageMagick's convert utility f... 9 9 \n",1021 "2 <p>ImageMagick delegates the PDF->bitmap conve... 25 25 \n",1022 "3 <p>One possibility is Hudson. It's written in... 23 23 \n",1023 "4 <p>We run <a href=\"http://buildbot.net/trac\">B... 20 20 \n",1024 "\n",1025 " date \n",1026 "0 2024-02-14 \n",1027 "1 2024-02-14 \n",1028 "2 2024-02-14 \n",1029 "3 2024-02-14 \n",1030 "4 2024-02-14 "1031 ]1032 },1033 "execution_count": 9,1034 "metadata": {},1035 "output_type": "execute_result"1036 }1037 ],1038 "source": [1039 "df.drop(columns=['OwnerUserId_x','CreationDate_x','Score_x','OwnerUserId_y','CreationDate_y'],inplace=True)\n",1040 "df.head()"1041 ]1042 },1043 {1044 "cell_type": "code",1045 "execution_count": 10,1046 "id": "15c46d77",1047 "metadata": {1048 "executionInfo": {1049 "elapsed": 13,1050 "status": "aborted",1051 "timestamp": 1698432323804,1052 "user": {1053 "displayName": "Jay Paun",1054 "userId": "02230944815040819432"1055 },1056 "user_tz": 2401057 },1058 "id": "15c46d77"1059 },1060 "outputs": [],1061 "source": [1062 "df.rename(columns={'Body_x':'Question','Body_y':'Answer','Score_y':'Score'},inplace=True)"1063 ]1064 },1065 {1066 "cell_type": "code",1067 "execution_count": 11,1068 "id": "b1fa97db",1069 "metadata": {1070 "executionInfo": {1071 "elapsed": 13,1072 "status": "aborted",1073 "timestamp": 1698432323804,1074 "user": {1075 "displayName": "Jay Paun",1076 "userId": "02230944815040819432"1077 },1078 "user_tz": 2401079 },1080 "id": "b1fa97db"1081 },1082 "outputs": [1083 {1084 "data": {1085 "text/html": [1086 "<div>\n",1087 "<style scoped>\n",1088 " .dataframe tbody tr th:only-of-type {\n",1089 " vertical-align: middle;\n",1090 " }\n",1091 "\n",1092 " .dataframe tbody tr th {\n",1093 " vertical-align: top;\n",1094 " }\n",1095 "\n",1096 " .dataframe thead th {\n",1097 " text-align: right;\n",1098 " }\n",1099 "</style>\n",1100 "<table border=\"1\" class=\"dataframe\">\n",1101 " <thead>\n",1102 " <tr style=\"text-align: right;\">\n",1103 " <th></th>\n",1104 " <th>QId</th>\n",1105 " <th>Title</th>\n",1106 " <th>Question</th>\n",1107 " <th>AId</th>\n",1108 " <th>Score</th>\n",1109 " <th>Answer</th>\n",1110 " <th>latest_score</th>\n",1111 " <th>alternate</th>\n",1112 " <th>date</th>\n",1113 " </tr>\n",1114 " </thead>\n",1115 " <tbody>\n",1116 " <tr>\n",1117 " <th>0</th>\n",1118 " <td>469</td>\n",1119 " <td>How can I find the full path to a font from it...</td>\n",1120 " <td><p>I am using the Photoshop's javascript API t...</td>\n",1121 " <td>3040</td>\n",1122 " <td>12</td>\n",1123 " <td><p>Unfortunately the only API that isn't depre...</td>\n",1124 " <td>12</td>\n",1125 " <td>12</td>\n",1126 " <td>2024-02-14</td>\n",1127 " </tr>\n",1128 " <tr>\n",1129 " <th>1</th>\n",1130 " <td>502</td>\n",1131 " <td>Get a preview JPEG of a PDF on Windows?</td>\n",1132 " <td><p>I have a cross-platform (Python) applicatio...</td>\n",1133 " <td>536</td>\n",1134 " <td>9</td>\n",1135 " <td><p>You can use ImageMagick's convert utility f...</td>\n",1136 " <td>9</td>\n",1137 " <td>9</td>\n",1138 " <td>2024-02-14</td>\n",1139 " </tr>\n",1140 " <tr>\n",1141 " <th>2</th>\n",1142 " <td>502</td>\n",1143 " <td>Get a preview JPEG of a PDF on Windows?</td>\n",1144 " <td><p>I have a cross-platform (Python) applicatio...</td>\n",1145 " <td>7090</td>\n",1146 " <td>25</td>\n",1147 " <td><p>ImageMagick delegates the PDF->bitmap conve...</td>\n",1148 " <td>25</td>\n",1149 " <td>25</td>\n",1150 " <td>2024-02-14</td>\n",1151 " </tr>\n",1152 " <tr>\n",1153 " <th>3</th>\n",1154 " <td>535</td>\n",1155 " <td>Continuous Integration System for a Python Cod...</td>\n",1156 " <td><p>I'm starting work on a hobby project with a...</td>\n",1157 " <td>538</td>\n",1158 " <td>23</td>\n",1159 " <td><p>One possibility is Hudson. It's written in...</td>\n",1160 " <td>23</td>\n",1161 " <td>23</td>\n",1162 " <td>2024-02-14</td>\n",1163 " </tr>\n",1164 " <tr>\n",1165 " <th>4</th>\n",1166 " <td>535</td>\n",1167 " <td>Continuous Integration System for a Python Cod...</td>\n",1168 " <td><p>I'm starting work on a hobby project with a...</td>\n",1169 " <td>541</td>\n",1170 " <td>20</td>\n",1171 " <td><p>We run <a href=\"http://buildbot.net/trac\">B...</td>\n",1172 " <td>20</td>\n",1173 " <td>20</td>\n",1174 " <td>2024-02-14</td>\n",1175 " </tr>\n",1176 " </tbody>\n",1177 "</table>\n",1178 "</div>"1179 ],1180 "text/plain": [1181 " QId Title \\\n",1182 "0 469 How can I find the full path to a font from it... \n",1183 "1 502 Get a preview JPEG of a PDF on Windows? \n",1184 "2 502 Get a preview JPEG of a PDF on Windows? \n",1185 "3 535 Continuous Integration System for a Python Cod... \n",1186 "4 535 Continuous Integration System for a Python Cod... \n",1187 "\n",1188 " Question AId Score \\\n",1189 "0 <p>I am using the Photoshop's javascript API t... 3040 12 \n",1190 "1 <p>I have a cross-platform (Python) applicatio... 536 9 \n",1191 "2 <p>I have a cross-platform (Python) applicatio... 7090 25 \n",1192 "3 <p>I'm starting work on a hobby project with a... 538 23 \n",1193 "4 <p>I'm starting work on a hobby project with a... 541 20 \n",1194 "\n",1195 " Answer latest_score alternate \\\n",1196 "0 <p>Unfortunately the only API that isn't depre... 12 12 \n",1197 "1 <p>You can use ImageMagick's convert utility f... 9 9 \n",1198 "2 <p>ImageMagick delegates the PDF->bitmap conve... 25 25 \n",1199 "3 <p>One possibility is Hudson. It's written in... 23 23 \n",1200 "4 <p>We run <a href=\"http://buildbot.net/trac\">B... 20 20 \n",