From cdff663570b890a6b82f96aa75b3cca3b743bae1 Mon Sep 17 00:00:00 2001
From: Lais Meireles Alves <141499800+laismeireles@users.noreply.github.com>
Date: Wed, 18 Oct 2023 18:06:16 -0300
Subject: [PATCH] Atividade pandas semana 11 Lais Meireles Alves
---
exercicios/para-casa/atividade_de_casa.ipynb | 795 ++++++++++++++++++
.../df_analise_sentimentos_reduzido.csv | 101 +++
2 files changed, 896 insertions(+)
create mode 100644 exercicios/para-casa/atividade_de_casa.ipynb
create mode 100644 exercicios/para-casa/df_analise_sentimentos_reduzido.csv
diff --git a/exercicios/para-casa/atividade_de_casa.ipynb b/exercicios/para-casa/atividade_de_casa.ipynb
new file mode 100644
index 0000000..314a169
--- /dev/null
+++ b/exercicios/para-casa/atividade_de_casa.ipynb
@@ -0,0 +1,795 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Bibliotecas Necessárias"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import pandas as pd"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Introdução\n",
+ "\n",
+ "Base de dados que reúne informações coletadas por meio da rede social Twitter com o objetivo de entender a opinião pública sobre sentimentos. O conjunto de dados inclui a categorização dos sentimentos, detalhes de data, hora e conteúdos dos tweets, de modo a possibilidar a análise dos sentimentos dos usuários da plataforma."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Processamento\n",
+ "\n",
+ "Funções que permitem o processamento da base de dados (database) no formato .csv"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Leitura do arquivo .csv utilizando a função pd.read_csv()\n",
+ "\n",
+ "df = pd.read_csv('analise_dos_sentimentos.csv')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 0 | \n",
+ " 1467810369 | \n",
+ " Mon Apr 06 22:19:45 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " _TheSpecialOne_ | \n",
+ " @switchfoot http://twitpic.com/2y1zl - Awww, that's a bummer. You shoulda got David Carr of Third Day to do it. ;D | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 0 | \n",
+ " 1467810672 | \n",
+ " Mon Apr 06 22:19:49 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " scotthamilton | \n",
+ " is upset that he can't update his Facebook by ... | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 0 | \n",
+ " 1467810917 | \n",
+ " Mon Apr 06 22:19:53 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " mattycus | \n",
+ " @Kenichan I dived many times for the ball. Man... | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 0 | \n",
+ " 1467811184 | \n",
+ " Mon Apr 06 22:19:57 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " ElleCTF | \n",
+ " my whole body feels itchy and like its on fire | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 0 1467810369 Mon Apr 06 22:19:45 PDT 2009 NO_QUERY _TheSpecialOne_ \\\n",
+ "0 0 1467810672 Mon Apr 06 22:19:49 PDT 2009 NO_QUERY scotthamilton \n",
+ "1 0 1467810917 Mon Apr 06 22:19:53 PDT 2009 NO_QUERY mattycus \n",
+ "2 0 1467811184 Mon Apr 06 22:19:57 PDT 2009 NO_QUERY ElleCTF \n",
+ "\n",
+ " @switchfoot http://twitpic.com/2y1zl - Awww, that's a bummer. You shoulda got David Carr of Third Day to do it. ;D \n",
+ "0 is upset that he can't update his Facebook by ... \n",
+ "1 @Kenichan I dived many times for the ball. Man... \n",
+ "2 my whole body feels itchy and like its on fire "
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Exibindo as três primeiras linhas do DataFrame\n",
+ "df.head(3)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "(1599999, 6)"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Verificando o tamanho do dataframe\n",
+ "\n",
+ "df.shape"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Index(['sentimentos', 'ID_tweet', 'data_tweet', 'termo_consultado',\n",
+ " 'nome_usuario', 'texto_tweet'],\n",
+ " dtype='object')"
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Exibindo o nome das colunas do dataframe\n",
+ "df.columns"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Index(['sentimentos', 'ID_tweet', 'data_tweet', 'termo_consultado',\n",
+ " 'nome_usuario', 'texto_tweet'],\n",
+ " dtype='object')"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Renomeando as colunas do dataframe\n",
+ "\n",
+ "df.rename(columns={'0': 'sentimentos', '1467810369': 'ID_tweet', 'Mon Apr 06 22:19:45 PDT 2009': 'data_tweet', 'NO_QUERY': 'termo_consultado', \\\n",
+ " '_TheSpecialOne_': 'nome_usuario', \"@switchfoot http://twitpic.com/2y1zl - Awww, that's a bummer. You shoulda got David Carr of Third Day to do it. ;D\": \"texto_tweet\"}, inplace=True)\n",
+ "df.columns"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " sentimentos | \n",
+ " ID_tweet | \n",
+ " data_tweet | \n",
+ " termo_consultado | \n",
+ " nome_usuario | \n",
+ " texto_tweet | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 849110 | \n",
+ " 4 | \n",
+ " 1565014948 | \n",
+ " Mon Apr 20 05:39:01 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " 000catnap000 | \n",
+ " @Wumbologist huh uhu...i see dead people xD ab... | \n",
+ "
\n",
+ " \n",
+ " | 1422099 | \n",
+ " 4 | \n",
+ " 2058432528 | \n",
+ " Sat Jun 06 14:55:54 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " 000catnap000 | \n",
+ " @Wumbologist hmmm...why not | \n",
+ "
\n",
+ " \n",
+ " | 1425084 | \n",
+ " 4 | \n",
+ " 2058981540 | \n",
+ " Sat Jun 06 16:00:48 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " 000catnap000 | \n",
+ " can't get enough of it http://bit.ly/134sSZ | \n",
+ "
\n",
+ " \n",
+ " | 1177062 | \n",
+ " 4 | \n",
+ " 1981357110 | \n",
+ " Sun May 31 08:59:07 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " 000catnap000 | \n",
+ " this is one of the cartoons i used to watch to... | \n",
+ "
\n",
+ " \n",
+ " | 1042667 | \n",
+ " 4 | \n",
+ " 1957229112 | \n",
+ " Thu May 28 23:53:20 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " 000catnap000 | \n",
+ " awake since six o'clock... i had two hours sle... | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " sentimentos ID_tweet data_tweet \\\n",
+ "849110 4 1565014948 Mon Apr 20 05:39:01 PDT 2009 \n",
+ "1422099 4 2058432528 Sat Jun 06 14:55:54 PDT 2009 \n",
+ "1425084 4 2058981540 Sat Jun 06 16:00:48 PDT 2009 \n",
+ "1177062 4 1981357110 Sun May 31 08:59:07 PDT 2009 \n",
+ "1042667 4 1957229112 Thu May 28 23:53:20 PDT 2009 \n",
+ "\n",
+ " termo_consultado nome_usuario \\\n",
+ "849110 NO_QUERY 000catnap000 \n",
+ "1422099 NO_QUERY 000catnap000 \n",
+ "1425084 NO_QUERY 000catnap000 \n",
+ "1177062 NO_QUERY 000catnap000 \n",
+ "1042667 NO_QUERY 000catnap000 \n",
+ "\n",
+ " texto_tweet \n",
+ "849110 @Wumbologist huh uhu...i see dead people xD ab... \n",
+ "1422099 @Wumbologist hmmm...why not \n",
+ "1425084 can't get enough of it http://bit.ly/134sSZ \n",
+ "1177062 this is one of the cartoons i used to watch to... \n",
+ "1042667 awake since six o'clock... i had two hours sle... "
+ ]
+ },
+ "execution_count": 20,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Realizanado o sort de valores\n",
+ "df.sort_values(by=['nome_usuario'], inplace=True)\n",
+ "\n",
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " sentimentos | \n",
+ " ID_tweet | \n",
+ " data_tweet | \n",
+ " termo_consultado | \n",
+ " nome_usuario | \n",
+ " texto_tweet | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 598956 | \n",
+ " 0 | \n",
+ " 2220417398 | \n",
+ " Thu Jun 18 03:01:24 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " alyssa_z4 | \n",
+ " Jogging, isnt REALLY that cool, especially if ... | \n",
+ "
\n",
+ " \n",
+ " | 641394 | \n",
+ " 0 | \n",
+ " 2235236407 | \n",
+ " Fri Jun 19 00:44:31 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " RickyDeHaas | \n",
+ " @BabeNatasha yeah maths is so boring!!! Nope i... | \n",
+ "
\n",
+ " \n",
+ " | 113143 | \n",
+ " 0 | \n",
+ " 1825711053 | \n",
+ " Sun May 17 06:36:26 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " kisioy | \n",
+ " Is freezing this morning... http://www.... | \n",
+ "
\n",
+ " \n",
+ " | 477622 | \n",
+ " 0 | \n",
+ " 2178277878 | \n",
+ " Mon Jun 15 07:27:48 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " cailamurphy | \n",
+ " Clouds are back. But I'm looking forward to ... | \n",
+ "
\n",
+ " \n",
+ " | 1505206 | \n",
+ " 4 | \n",
+ " 2072317755 | \n",
+ " Sun Jun 07 20:47:48 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " NinaCoolada22 | \n",
+ " Northside.....what what...taken x-rays for the... | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 928115 | \n",
+ " 4 | \n",
+ " 1759465333 | \n",
+ " Sun May 10 19:16:18 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " davidmyers | \n",
+ " @WWSIV haha, maybe for you, but I take my last... | \n",
+ "
\n",
+ " \n",
+ " | 1132111 | \n",
+ " 4 | \n",
+ " 1975968090 | \n",
+ " Sat May 30 16:17:48 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " caffeinatedelf | \n",
+ " @amysnotdeadyet ooooooh. can i come over and h... | \n",
+ "
\n",
+ " \n",
+ " | 92822 | \n",
+ " 0 | \n",
+ " 1760235679 | \n",
+ " Sun May 10 21:00:10 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " Suhaila | \n",
+ " I want to display my pretty voltron! Upsid... | \n",
+ "
\n",
+ " \n",
+ " | 934084 | \n",
+ " 4 | \n",
+ " 1792326588 | \n",
+ " Wed May 13 22:48:53 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " missbrodieee | \n",
+ " going to stef's birthday dinner tonight | \n",
+ "
\n",
+ " \n",
+ " | 35034 | \n",
+ " 0 | \n",
+ " 1565040585 | \n",
+ " Mon Apr 20 05:43:35 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " tvecero | \n",
+ " Still sick, I really want to go back to bed. ... | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
100 rows × 6 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " sentimentos ID_tweet data_tweet \\\n",
+ "598956 0 2220417398 Thu Jun 18 03:01:24 PDT 2009 \n",
+ "641394 0 2235236407 Fri Jun 19 00:44:31 PDT 2009 \n",
+ "113143 0 1825711053 Sun May 17 06:36:26 PDT 2009 \n",
+ "477622 0 2178277878 Mon Jun 15 07:27:48 PDT 2009 \n",
+ "1505206 4 2072317755 Sun Jun 07 20:47:48 PDT 2009 \n",
+ "... ... ... ... \n",
+ "928115 4 1759465333 Sun May 10 19:16:18 PDT 2009 \n",
+ "1132111 4 1975968090 Sat May 30 16:17:48 PDT 2009 \n",
+ "92822 0 1760235679 Sun May 10 21:00:10 PDT 2009 \n",
+ "934084 4 1792326588 Wed May 13 22:48:53 PDT 2009 \n",
+ "35034 0 1565040585 Mon Apr 20 05:43:35 PDT 2009 \n",
+ "\n",
+ " termo_consultado nome_usuario \\\n",
+ "598956 NO_QUERY alyssa_z4 \n",
+ "641394 NO_QUERY RickyDeHaas \n",
+ "113143 NO_QUERY kisioy \n",
+ "477622 NO_QUERY cailamurphy \n",
+ "1505206 NO_QUERY NinaCoolada22 \n",
+ "... ... ... \n",
+ "928115 NO_QUERY davidmyers \n",
+ "1132111 NO_QUERY caffeinatedelf \n",
+ "92822 NO_QUERY Suhaila \n",
+ "934084 NO_QUERY missbrodieee \n",
+ "35034 NO_QUERY tvecero \n",
+ "\n",
+ " texto_tweet \n",
+ "598956 Jogging, isnt REALLY that cool, especially if ... \n",
+ "641394 @BabeNatasha yeah maths is so boring!!! Nope i... \n",
+ "113143 Is freezing this morning... http://www.... \n",
+ "477622 Clouds are back. But I'm looking forward to ... \n",
+ "1505206 Northside.....what what...taken x-rays for the... \n",
+ "... ... \n",
+ "928115 @WWSIV haha, maybe for you, but I take my last... \n",
+ "1132111 @amysnotdeadyet ooooooh. can i come over and h... \n",
+ "92822 I want to display my pretty voltron! Upsid... \n",
+ "934084 going to stef's birthday dinner tonight \n",
+ "35034 Still sick, I really want to go back to bed. ... \n",
+ "\n",
+ "[100 rows x 6 columns]"
+ ]
+ },
+ "execution_count": 21,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Reduzindo o tamanho do dataframe\n",
+ "\n",
+ "df_reduzido = df.sample(100)\n",
+ "df_reduzido"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " sentimentos | \n",
+ " ID_tweet | \n",
+ " data_tweet | \n",
+ " termo_consultado | \n",
+ " nome_usuario | \n",
+ " texto_tweet | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 598956 | \n",
+ " 0 | \n",
+ " 2220417398 | \n",
+ " Thu Jun 18 03:01:24 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " alyssa_z4 | \n",
+ " Jogging, isnt REALLY that cool, especially if ... | \n",
+ "
\n",
+ " \n",
+ " | 641394 | \n",
+ " 0 | \n",
+ " 2235236407 | \n",
+ " Fri Jun 19 00:44:31 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " RickyDeHaas | \n",
+ " @BabeNatasha yeah maths is so boring!!! Nope i... | \n",
+ "
\n",
+ " \n",
+ " | 113143 | \n",
+ " 0 | \n",
+ " 1825711053 | \n",
+ " Sun May 17 06:36:26 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " kisioy | \n",
+ " Is freezing this morning... http://www.... | \n",
+ "
\n",
+ " \n",
+ " | 477622 | \n",
+ " 0 | \n",
+ " 2178277878 | \n",
+ " Mon Jun 15 07:27:48 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " cailamurphy | \n",
+ " Clouds are back. But I'm looking forward to ... | \n",
+ "
\n",
+ " \n",
+ " | 1505206 | \n",
+ " 4 | \n",
+ " 2072317755 | \n",
+ " Sun Jun 07 20:47:48 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " NinaCoolada22 | \n",
+ " Northside.....what what...taken x-rays for the... | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 928115 | \n",
+ " 4 | \n",
+ " 1759465333 | \n",
+ " Sun May 10 19:16:18 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " davidmyers | \n",
+ " @WWSIV haha, maybe for you, but I take my last... | \n",
+ "
\n",
+ " \n",
+ " | 1132111 | \n",
+ " 4 | \n",
+ " 1975968090 | \n",
+ " Sat May 30 16:17:48 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " caffeinatedelf | \n",
+ " @amysnotdeadyet ooooooh. can i come over and h... | \n",
+ "
\n",
+ " \n",
+ " | 92822 | \n",
+ " 0 | \n",
+ " 1760235679 | \n",
+ " Sun May 10 21:00:10 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " Suhaila | \n",
+ " I want to display my pretty voltron! Upsid... | \n",
+ "
\n",
+ " \n",
+ " | 934084 | \n",
+ " 4 | \n",
+ " 1792326588 | \n",
+ " Wed May 13 22:48:53 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " missbrodieee | \n",
+ " going to stef's birthday dinner tonight | \n",
+ "
\n",
+ " \n",
+ " | 35034 | \n",
+ " 0 | \n",
+ " 1565040585 | \n",
+ " Mon Apr 20 05:43:35 PDT 2009 | \n",
+ " NO_QUERY | \n",
+ " tvecero | \n",
+ " Still sick, I really want to go back to bed. ... | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
100 rows × 6 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " sentimentos ID_tweet data_tweet \\\n",
+ "598956 0 2220417398 Thu Jun 18 03:01:24 PDT 2009 \n",
+ "641394 0 2235236407 Fri Jun 19 00:44:31 PDT 2009 \n",
+ "113143 0 1825711053 Sun May 17 06:36:26 PDT 2009 \n",
+ "477622 0 2178277878 Mon Jun 15 07:27:48 PDT 2009 \n",
+ "1505206 4 2072317755 Sun Jun 07 20:47:48 PDT 2009 \n",
+ "... ... ... ... \n",
+ "928115 4 1759465333 Sun May 10 19:16:18 PDT 2009 \n",
+ "1132111 4 1975968090 Sat May 30 16:17:48 PDT 2009 \n",
+ "92822 0 1760235679 Sun May 10 21:00:10 PDT 2009 \n",
+ "934084 4 1792326588 Wed May 13 22:48:53 PDT 2009 \n",
+ "35034 0 1565040585 Mon Apr 20 05:43:35 PDT 2009 \n",
+ "\n",
+ " termo_consultado nome_usuario \\\n",
+ "598956 NO_QUERY alyssa_z4 \n",
+ "641394 NO_QUERY RickyDeHaas \n",
+ "113143 NO_QUERY kisioy \n",
+ "477622 NO_QUERY cailamurphy \n",
+ "1505206 NO_QUERY NinaCoolada22 \n",
+ "... ... ... \n",
+ "928115 NO_QUERY davidmyers \n",
+ "1132111 NO_QUERY caffeinatedelf \n",
+ "92822 NO_QUERY Suhaila \n",
+ "934084 NO_QUERY missbrodieee \n",
+ "35034 NO_QUERY tvecero \n",
+ "\n",
+ " texto_tweet \n",
+ "598956 Jogging, isnt REALLY that cool, especially if ... \n",
+ "641394 @BabeNatasha yeah maths is so boring!!! Nope i... \n",
+ "113143 Is freezing this morning... http://www.... \n",
+ "477622 Clouds are back. But I'm looking forward to ... \n",
+ "1505206 Northside.....what what...taken x-rays for the... \n",
+ "... ... \n",
+ "928115 @WWSIV haha, maybe for you, but I take my last... \n",
+ "1132111 @amysnotdeadyet ooooooh. can i come over and h... \n",
+ "92822 I want to display my pretty voltron! Upsid... \n",
+ "934084 going to stef's birthday dinner tonight \n",
+ "35034 Still sick, I really want to go back to bed. ... \n",
+ "\n",
+ "[100 rows x 6 columns]"
+ ]
+ },
+ "execution_count": 22,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df_reduzido.rename(columns={'0': 'sentimentos', '1467810369': 'ID_tweet', 'Mon Apr 06 22:19:45 PDT 2009': 'data_tweet', 'NO_QUERY': 'termo_consultado', \\\n",
+ " '_TheSpecialOne_': 'nome_usuario', \"@switchfoot http://twitpic.com/2y1zl - Awww, that's a bummer. \\\n",
+ " You shoulda got David Carr of Third Day to do it. ;D\": \"texto_tweet\"}, inplace=True)\n",
+ "df_reduzido"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "sentimentos 0\n",
+ "ID_tweet 0\n",
+ "data_tweet 0\n",
+ "termo_consultado 0\n",
+ "nome_usuario 0\n",
+ "texto_tweet 0\n",
+ "dtype: int64"
+ ]
+ },
+ "execution_count": 24,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Remoção de nulos \n",
+ "\n",
+ "df_reduzido.isnull().sum()\n",
+ "\n",
+ "# Não há dados nulos a serem removidos"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Removendo dados repetidos\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Cópia do dataframe inicial"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Exportando o dataframe para um arquivo .csv\n",
+ "df_reduzido.to_csv(\"df_analise_sentimentos_reduzido.csv\")"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "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.4"
+ },
+ "orig_nbformat": 4
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/exercicios/para-casa/df_analise_sentimentos_reduzido.csv b/exercicios/para-casa/df_analise_sentimentos_reduzido.csv
new file mode 100644
index 0000000..7dd44d2
--- /dev/null
+++ b/exercicios/para-casa/df_analise_sentimentos_reduzido.csv
@@ -0,0 +1,101 @@
+,sentimentos,ID_tweet,data_tweet,termo_consultado,nome_usuario,texto_tweet
+598956,0,2220417398,Thu Jun 18 03:01:24 PDT 2009,NO_QUERY,alyssa_z4,"Jogging, isnt REALLY that cool, especially if you've got a fever "
+641394,0,2235236407,Fri Jun 19 00:44:31 PDT 2009,NO_QUERY,RickyDeHaas,@BabeNatasha yeah maths is so boring!!! Nope it was the last test before the exam
+113143,0,1825711053,Sun May 17 06:36:26 PDT 2009,NO_QUERY,kisioy,Is freezing this morning... http://www.kisioy.com/
+477622,0,2178277878,Mon Jun 15 07:27:48 PDT 2009,NO_QUERY,cailamurphy,Clouds are back. But I'm looking forward to a fun day with my hubby at home!
+1505206,4,2072317755,Sun Jun 07 20:47:48 PDT 2009,NO_QUERY,NinaCoolada22,Northside.....what what...taken x-rays for the broken
+105126,0,1822866537,Sat May 16 20:34:13 PDT 2009,NO_QUERY,kittiegoesrawr,wow. tattoo pain. and i feel like crap.
+1306925,4,2012133855,Tue Jun 02 20:07:30 PDT 2009,NO_QUERY,Alevesque,@GriffinClubMerv their bread is prebaked and frozen that's why all subs are toasted. Good choice on the 6" spicy it was my lunch today
+479709,0,2178981576,Mon Jun 15 08:28:47 PDT 2009,NO_QUERY,MsFlipper,Dang! My new laptop doesn't fit the briefcase bag!! Gotta buy a new one
+1405094,4,2055135974,Sat Jun 06 08:45:55 PDT 2009,NO_QUERY,iiCrayons,much better ilove that song ;D
+811505,4,1470072119,Tue Apr 07 08:15:50 PDT 2009,NO_QUERY,Helen_Rooney,one more day until my 5 day weekend all I have going on today is lunch with my grandparents then doing some homework later
+779139,0,2322857471,Wed Jun 24 23:24:56 PDT 2009,NO_QUERY,NickyMcB,@sociaIIyawkward I cant move on!!! It is impossible!! What do u mean growing up? lol
+230972,0,1978861455,Sun May 31 00:43:34 PDT 2009,NO_QUERY,lauraAHchooo,@MeganThompson. I miss them too.
+1033812,4,1955872495,Thu May 28 20:46:17 PDT 2009,NO_QUERY,DayDreamerTeen,What am I most looking forward to right now? The fact that the first official New Moon trailer is going to be released on Sunday
+62780,0,1687246397,Sun May 03 08:10:36 PDT 2009,NO_QUERY,kirstyf1995,@iLoveWLT JB didn't go to the event
+1443555,4,2062136309,Sat Jun 06 22:25:32 PDT 2009,NO_QUERY,reifitaa960,@sharasandi just tweeting.......
+1563895,4,2187176486,Mon Jun 15 19:54:10 PDT 2009,NO_QUERY,shuggalipz,jus chillin wit da bestie <courtney> and not givin a fuk bout da rest
+541495,0,2200113316,Tue Jun 16 18:27:24 PDT 2009,NO_QUERY,TDKnuckle,still not tired but now everyone is off mns
+1393615,4,2053529402,Sat Jun 06 04:52:39 PDT 2009,NO_QUERY,miss_lakwatsera,miss you all today!
+493874,0,2184741041,Mon Jun 15 16:21:05 PDT 2009,NO_QUERY,fireproofed03,@hillarychaney haha that made me laugh. We need to see eachother.
+176025,0,1965096947,Fri May 29 15:19:38 PDT 2009,NO_QUERY,pseudoprime,@Rubios_BeachMex Can't DM you since you don't follow me.
+559066,0,2204895330,Wed Jun 17 03:25:08 PDT 2009,NO_QUERY,CassieFoxAXO,I feel so bad for my little baby she is so stuffed up and has the worst cough... She finally caught her cousin's cold
+586367,0,2215939883,Wed Jun 17 18:49:24 PDT 2009,NO_QUERY,vetenskapsman,is cleaning up his iTunes library in anticipation of being able to store 75% of his music on the 3GS :-D but has only made it to "C"
+1357327,4,2047967222,Fri Jun 05 14:27:22 PDT 2009,NO_QUERY,spacekdt1,@Eaw1987 paralell worlds. At the gym too
+792530,0,2326315538,Thu Jun 25 06:52:05 PDT 2009,NO_QUERY,apathyisafad,25$ only gets me half a tank.
+838269,4,1559036680,Sun Apr 19 10:05:06 PDT 2009,NO_QUERY,softballgirly12,watching the prince and me
+1412809,4,2056733442,Sat Jun 06 11:41:34 PDT 2009,NO_QUERY,LindsDesiree,http://bit.ly/oSc03 destination in 3-d?! i'm soo there!
+654329,0,2239366954,Fri Jun 19 08:27:23 PDT 2009,NO_QUERY,ainhd,"@Shaleyah You're welcome and thank YOU! BTW, I didn't realize it was a 12-week tour Too long, sis, too long. But make the most of it!"
+1312627,4,2013681664,Tue Jun 02 23:17:29 PDT 2009,NO_QUERY,biatchillicious,80's music + rainy weather = i love.
+435410,0,2065417946,Sun Jun 07 08:33:15 PDT 2009,NO_QUERY,omgstephanie,This is going to be a LONG 6 hours
+708695,0,2257379823,Sat Jun 20 14:14:42 PDT 2009,NO_QUERY,Difegue,feeling dizzy since lunch. Man I haven't even been on a videogame rampage or anything Better go to bed before my mind goes dakota
+389433,0,2054454345,Sat Jun 06 07:23:19 PDT 2009,NO_QUERY,tynie626,@Diligent1 ahhh that's not cool sorry to hear it
+1330802,4,2015875499,Wed Jun 03 05:42:36 PDT 2009,NO_QUERY,amykayclark,@YourNHRealtor You will need to shorten it probably...go to tinyurl.com. It will create a shorter link. Then you just paste it here.
+412202,0,2060292129,Sat Jun 06 18:37:51 PDT 2009,NO_QUERY,xxkiwibrandiexx,"found out i dont have cancer, but i am anemic. "
+400637,0,2057460504,Sat Jun 06 13:02:48 PDT 2009,NO_QUERY,eddie_cruz,@Kathrynnaomi they didn't come out as well as I expected. they shrink a lot though.
+369826,0,2049978645,Fri Jun 05 17:50:43 PDT 2009,NO_QUERY,inashlalaland,"im TIRED of all of that SHET.im tired, n i fell like i can't go on! when happen this ? when did you do this to me? i wasn't that person "
+394008,0,2055533594,Sat Jun 06 09:29:35 PDT 2009,NO_QUERY,michalbr,help i'm playing sims 3 all day
+160149,0,1957002082,Thu May 28 23:14:52 PDT 2009,NO_QUERY,V0NST3V3,"Last day working for the Uni today, sad times "
+416821,0,2061389856,Sat Jun 06 20:46:05 PDT 2009,NO_QUERY,SavieHaircore,@Scootamazing i will throw a poptart at you! haha
+265101,0,1988733442,Sun May 31 23:12:57 PDT 2009,NO_QUERY,Hibippytea,"@1cutechicwitfm A friend of mine said those words earlier and I am just passing it along , she was not too happy either "
+1265652,4,1999485475,Mon Jun 01 20:18:03 PDT 2009,NO_QUERY,walkdesign,"@scottydigital @TheRealTMR Matt, you should wear a Yellow Zig Zag shirt when you throw out the pitch! "
+872520,4,1679041328,Sat May 02 08:23:22 PDT 2009,NO_QUERY,magicfm,@Kimmydavies excellent - on an ice cream break at the moment - will forward more details later
+198341,0,1971198023,Sat May 30 06:29:24 PDT 2009,NO_QUERY,mercydrummer,@audreyawesome we are on the way now it's like a 5 hour drive though.
+80615,0,1752401677,Sat May 09 21:49:29 PDT 2009,NO_QUERY,hypesis,Station 9 was jumping tonight! So sad I had to leave!!!
+664564,0,2244535868,Fri Jun 19 14:52:34 PDT 2009,NO_QUERY,ohhhbabyyy,@CyroSofi awe i'm sorry love! what's wrong?
+47244,0,1677590663,Sat May 02 02:55:03 PDT 2009,NO_QUERY,shoberzz,@gkyla Twitter said my picture is too big.
+78998,0,1751630428,Sat May 09 19:54:12 PDT 2009,NO_QUERY,FlammableGoose,@xlovexaholicx am not. last time i checked im the definition of koolness LOL jk.. yeah T__Tso mean
+1058209,4,1962884865,Fri May 29 11:51:37 PDT 2009,NO_QUERY,superandy_07,"at bones bbq, guid banter "
+1571842,4,2188835415,Mon Jun 15 22:39:47 PDT 2009,NO_QUERY,Nileyluvv,http://twitpic.com/7iyp6 - VOtE 4 MilEY CYRUS tEEN ChOiiCE AWARdS 09 www.teenchoiceawards.com && niley 4 best couple
+536335,0,2198364585,Tue Jun 16 15:58:39 PDT 2009,NO_QUERY,modernheiress,i need to get out of the house.. too much shit is going on..
+770247,0,2301930581,Tue Jun 23 16:06:17 PDT 2009,NO_QUERY,warriordude07,I wanna play xbox
+531803,0,2196506526,Tue Jun 16 12:33:47 PDT 2009,NO_QUERY,Jockin_JB,@GnarlyNichole Oh shit that sucks!!!!
+1140107,4,1977005164,Sat May 30 19:50:41 PDT 2009,NO_QUERY,etherjammer,"@hawkster, awesome! Well done. "
+267230,0,1989152057,Mon Jun 01 00:31:08 PDT 2009,NO_QUERY,bambamboogie,@Britneezy im NOT bout 2 go outside by myself. its dark as shit. im scared of the dark but i SWORE i brought it nside. my bro saw it 2!!
+239093,0,1980551294,Sun May 31 07:03:29 PDT 2009,NO_QUERY,rokusasu_xiii,i dont feel so good blehhh
+510789,0,2189740634,Tue Jun 16 00:47:14 PDT 2009,NO_QUERY,SurrealMystery,I FINALLY read the "Penny: Keep Your Head Up" comic! I was so sad at the end...
+159683,0,1956894216,Thu May 28 22:58:01 PDT 2009,NO_QUERY,MsMusicMarino,@Kamakacci_Juice YES!! is that bad?
+1400000,4,2054321872,Sat Jun 06 07:05:33 PDT 2009,NO_QUERY,forbairt,@kdaly100 ouch ... when she's back to you in 3 months saying its still not working ...
+184603,0,1967749063,Fri May 29 20:08:36 PDT 2009,NO_QUERY,jaeBrook,@sasssy_thang what about me http://myloc.me/233q
+1587480,4,2190949659,Tue Jun 16 04:09:17 PDT 2009,NO_QUERY,anggaputra,Finished eating at mcd (again!) Now sency-ing http://myloc.me/40TA
+1549397,4,2183425948,Mon Jun 15 14:29:22 PDT 2009,NO_QUERY,Bethybbz,@actorbaybee love you too sweetie...hope it works!
+919068,4,1753758689,Sun May 10 03:17:32 PDT 2009,NO_QUERY,ssshhmack,just got home and my kitty was by my door waiting for me
+287061,0,1994088487,Mon Jun 01 11:23:44 PDT 2009,NO_QUERY,jonyceruiz,"Working from home again...hubby, Mary & I are all still sick. Hopefully we can fight through this thing soon."
+836277,4,1558424241,Sun Apr 19 08:19:59 PDT 2009,NO_QUERY,Huntravess,@Dirk_Gently Thank you.
+674353,0,2247765396,Fri Jun 19 19:35:26 PDT 2009,NO_QUERY,kirrily,@SarahHen @FeistyKel @tantoamore you'll all be missed this afternoon
+1198668,4,1985183827,Sun May 31 16:36:00 PDT 2009,NO_QUERY,thisgoeshere,@xxkassyxx welcome! it just was a cool premise. and patrick was cute. hey! i need the link for your pg again. gotta read more!
+690518,0,2252034230,Sat Jun 20 05:16:36 PDT 2009,NO_QUERY,giiiix3,Boredddd at work text meee
+882711,4,1686012842,Sun May 03 03:17:11 PDT 2009,NO_QUERY,Powanono,@skynash is it your student room in London?
+1185692,4,1982820318,Sun May 31 11:58:07 PDT 2009,NO_QUERY,sufrj,@TexTrader But I certainly think that its a good quote
+477205,0,2178117816,Mon Jun 15 07:13:13 PDT 2009,NO_QUERY,malenga,"I wish Google Voice/Grandcentral allowed you to change your number. Forever stuck with a G'ville, FL one I guess. "
+1002739,4,1880245248,Fri May 22 00:34:35 PDT 2009,NO_QUERY,EliasWallace,Bout to jump on the train to Arhus for the SPOT festival in Denmark. Come watch Dafuniks David Fricke!!!
+670687,0,2246641049,Fri Jun 19 17:54:23 PDT 2009,NO_QUERY,caysiegilbank,@barbiegirl20 ahhh my @ in your ff didnt work!
+1110344,4,1972046832,Sat May 30 08:26:58 PDT 2009,NO_QUERY,andrea_r,@annahawthorne cuz I'm online all day anyway?
+378178,0,2052054767,Fri Jun 05 23:31:41 PDT 2009,NO_QUERY,lupe_90,Srry guys
+274665,0,1990643531,Mon Jun 01 05:24:03 PDT 2009,NO_QUERY,faddict,@goaskalicia i know the feeling. here's hoping you win the lottery!
+288417,0,1994576448,Mon Jun 01 12:07:59 PDT 2009,NO_QUERY,D_Child,"@ramaro17 Now u know why im pissed,sad and upset! Really dunno what this is tho "
+1209899,4,1988987416,Sun May 31 23:59:24 PDT 2009,NO_QUERY,avalkyrie,Also there was a TESLA COIL #makerfaire http://yfrog.com/59w1rj
+224839,0,1977509009,Sat May 30 21:06:56 PDT 2009,NO_QUERY,Jessicaveronica,I dont want to leave home
+582250,0,2214550798,Wed Jun 17 16:54:17 PDT 2009,NO_QUERY,honey_is_evil,my foooooooooot huuuurts. OW!!
+1512959,4,2175296361,Mon Jun 15 00:35:56 PDT 2009,NO_QUERY,Richardrubio,"Goodnight everyone! Hopefully, this week will be epic. "
+1353788,4,2046836459,Fri Jun 05 12:45:49 PDT 2009,NO_QUERY,taylorbath,Hanging out with some friends/stocking up at lcbo/drunk somewhere? Text the cell! 9054406161 <3
+1145229,4,1977747730,Sat May 30 21:37:14 PDT 2009,NO_QUERY,SteveChaiGuy,@Gen22 and I know that they r only for me!! How sweet if u!!
+582150,0,2214513056,Wed Jun 17 16:51:01 PDT 2009,NO_QUERY,ThisSongPlays,@Markhoppus dude... its worse with a seven year old and a five yr old who think jack in the ass toys rule the damned world!
+1408902,4,2055772875,Sat Jun 06 09:55:45 PDT 2009,NO_QUERY,_andre1313,@xoxallixox im not kidding u! its cute!
+606014,0,2222445990,Thu Jun 18 06:59:45 PDT 2009,NO_QUERY,MamasitaNena,@chris_austintx ditto and it sucks.
+392581,0,2055180505,Sat Jun 06 08:51:02 PDT 2009,NO_QUERY,sisysisysisy,"swear to everything in this world , I've never felt this feeling even for once on my life . . it makes my breath packed "
+1066484,4,1965316263,Fri May 29 15:42:18 PDT 2009,NO_QUERY,_eidolon,"taking pictures of my neice, ... gotta get back to photos and editing, i miss my art "
+1535027,4,2178909375,Mon Jun 15 08:22:42 PDT 2009,NO_QUERY,iheartuga119,@KATaylor007 I agree!! No one else quite understands my obsession.
+1384604,4,2052670481,Sat Jun 06 01:34:13 PDT 2009,NO_QUERY,adparlor,You need more details in the review Robert L. http://tinyurl.com/qahkqp
+744350,0,2267109510,Sun Jun 21 09:38:29 PDT 2009,NO_QUERY,nminiaci,tired and gotta work today!!! i have to study so someone better take my shift
+422785,0,2062728913,Sun Jun 07 00:06:39 PDT 2009,NO_QUERY,DEAlter,I hate when MegaVideo cuts me off 7 minutes before the end of my show...
+99614,0,1793678688,Thu May 14 03:36:28 PDT 2009,NO_QUERY,wishbearxx_,@vivyenx Yeah we were sad nga you didnt make it eh. Rose-An din.
+1562892,4,2186930960,Mon Jun 15 19:32:38 PDT 2009,NO_QUERY,jwjecha,And here I was waiting to hear from my Cleveland friend about the game's final score... I might be giving him a call instead...
+1119386,4,1973760023,Sat May 30 11:46:48 PDT 2009,NO_QUERY,georgewezsley,@ThePBG cool
+587643,0,2216392095,Wed Jun 17 19:25:21 PDT 2009,NO_QUERY,lathiat,iPhone on Three (http://store.three.com.au/Apple-iPhone-3G-Coming-Soon) but in july .. I guess that means I won't be getting one on day 1
+593201,0,2218176312,Wed Jun 17 22:01:13 PDT 2009,NO_QUERY,Msdivine20,@TheRealSavage How about Pink Briefs with the butt cut out?
+928115,4,1759465333,Sun May 10 19:16:18 PDT 2009,NO_QUERY,davidmyers,"@WWSIV haha, maybe for you, but I take my last final sometime tonight when I feel like it. Have fun in the morning "
+1132111,4,1975968090,Sat May 30 16:17:48 PDT 2009,NO_QUERY,caffeinatedelf,@amysnotdeadyet ooooooh. can i come over and help you eat??
+92822,0,1760235679,Sun May 10 21:00:10 PDT 2009,NO_QUERY,Suhaila," I want to display my pretty voltron! Upside, I get two pretty voltrons!"
+934084,4,1792326588,Wed May 13 22:48:53 PDT 2009,NO_QUERY,missbrodieee,going to stef's birthday dinner tonight
+35034,0,1565040585,Mon Apr 20 05:43:35 PDT 2009,NO_QUERY,tvecero,"Still sick, I really want to go back to bed. As soon as I get home that is where I am heading."