{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "ZmpUVYOdKcSK" }, "source": [ "# `Sección 1` Dataset Overview\n" ] }, { "cell_type": "markdown", "metadata": { "id": "45MdkwEdQlw2" }, "source": [ "En esta sección se realiza la conexión, carga y visualización del archivo de tweets" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1.1 Conectar con Google Drive\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Realizar la conexión con Google Drive" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Importa PyDrive y las librerías asociadas\n", "# Eso es necesario hacer una solo ver por notebook\n", "from pydrive.auth import GoogleAuth\n", "from pydrive.drive import GoogleDrive\n", "from google.colab import auth\n", "from oauth2client.client import GoogleCredentials\n", "\n", "# Autentica y crea el cliente PyDrive\n", "# Eso es necesario hacer una solo ver por notebook\n", "auth.authenticate_user()\n", "gauth = GoogleAuth()\n", "gauth.credentials = GoogleCredentials.get_application_default()\n", "drive = GoogleDrive(gauth)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Descargar un archivo basado en su file ID\n", "\n", "# Un file ID es similiar a: laggVyWshwcyP6kEI-y_W3P8D26sz\n", "file_id = '188UrD8KLsu7_RAWzJmULUkqKtGPgXp5-' # Chequear su file ID en google drive\n", "downloaded = drive.CreateFile({'id': file_id})\n", "\n", "# Guarda tu archivo en Colab memory\n", "downloaded.GetContentFile('tweet.csv')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## **1.2** Cargar y analizar datos" ] }, { "cell_type": "markdown", "metadata": { "id": "CwvCrELUSx4E" }, "source": [ "* `Pandas`: https://pandas.pydata.org/docs/\n", "* `Numpy`: https://numpy.org/doc/\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!pip install pandas numpy openpyxl matplotlib wordcloud" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "executionInfo": { "elapsed": 496, "status": "ok", "timestamp": 1754439693296, "user": { "displayName": "Eduardo Montero", "userId": "08026561778973164523" }, "user_tz": 180 }, "id": "P7zUNW9rS4Ud" }, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 98, "metadata": { "executionInfo": { "elapsed": 72, "status": "ok", "timestamp": 1754439714000, "user": { "displayName": "Eduardo Montero", "userId": "08026561778973164523" }, "user_tz": 180 }, "id": "GlIRIuTES32c" }, "outputs": [], "source": [ "df = pd.read_csv(\"tweets.csv\", sep=\",\")" ] }, { "cell_type": "code", "execution_count": 89, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | textID | \n", "tweet_text | \n", "sentiment | \n", "
|---|---|---|---|
| 0 | \n", "1956967666 | \n", "Layin n bed with a headache ughhhh...waitin o... | \n", "negative | \n", "
| 1 | \n", "1956967696 | \n", "Funeral ceremony...gloomy friday... | \n", "negative | \n", "
| 2 | \n", "1956967789 | \n", "wants to hang out with friends SOON! | \n", "positive | \n", "
| 3 | \n", "1956968477 | \n", "Re-pinging @ghostridah14: why didn't you go to... | \n", "negative | \n", "
| 4 | \n", "1956968636 | \n", "Hmmm. http://www.djhero.com/ is down | \n", "negative | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "
| 94 | \n", "1957008292 | \n", "@TheLastDoctor 9 days I'm about ready to visi... | \n", "positive | \n", "
| 95 | \n", "1957008434 | \n", "@Bern_morley where are you? In Bris? I can't h... | \n", "negative | \n", "
| 96 | \n", "1957008498 | \n", "Too bad the Red Devils.. disappointing to say ... | \n", "negative | \n", "
| 97 | \n", "1957008802 | \n", "@xdjio Have a 3ware 9650SE, not fast enough fo... | \n", "negative | \n", "
| 98 | \n", "1957008987 | \n", "when da heck will the garage man get here I as... | \n", "negative | \n", "
99 rows × 3 columns
\n", "| \n", " | textID | \n", "tweet_text | \n", "sentiment | \n", "
|---|---|---|---|
| 21 | \n", "1956976312 | \n", "@ether_radio yeah :S i feel all funny cause i ... | \n", "negative | \n", "
| 42 | \n", "1956985758 | \n", "@shondarhimes Sure you will tweet about this w... | \n", "negative | \n", "
| 85 | \n", "1957005713 | \n", "@nzdeany I've given up on pizza - kids would n... | \n", "negative | \n", "
| 22 | \n", "1956977084 | \n", "mmm much better day... so far! it's still quit... | \n", "positive | \n", "
| 63 | \n", "1956996385 | \n", "@freepbx sounds good. Appreciate the suggestio... | \n", "positive | \n", "
| 72 | \n", "1957000290 | \n", "I cant sleep, but im too sore to move | \n", "negative | \n", "
| 71 | \n", "1957000040 | \n", "Just cross 'cause I'm stuck twiddling my thumb... | \n", "negative | \n", "
| 0 | \n", "1956967666 | \n", "Layin n bed with a headache ughhhh...waitin o... | \n", "negative | \n", "
| 35 | \n", "1956983171 | \n", "Ok ... the passengers ... no one is alive ... ... | \n", "negative | \n", "
| 52 | \n", "1956990288 | \n", "@mrgenius23 You win ... SIGH Rakeem | \n", "positive | \n", "