Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Python pra analistas de comunicação (1)

27 views

Published on

Este é o primeiro report com cem mil tweets sobre as #eleições2018.

Published in: News & Politics
  • Be the first to comment

  • Be the first to like this

Python pra analistas de comunicação (1)

  1. 1. blog-post-1-python March 12, 2019 1 Python para analistas de marketing (1) Por Nadja Pereira, especialista em insights, professora assistente de digital analytics na FIA e cientista de dados em forma��o. E-mail: nadja@nadjapereira.com In [ ]: #importa��o da biblioteca pandas #importa��o da planilha upada no pandas import pandas as pd elei��es = pd.read_excel('elei��es1.xlsx') In [16]: elei��es.head() Out[16]: id guid 0 1 https://twitter.com/omarcostorres/statuses/104... 1 2 https://twitter.com/cChantilly_/statuses/10471... 2 3 https://twitter.com/det_thais/statuses/1047170... 3 4 https://twitter.com/kittenburton/statuses/1047... 4 5 https://twitter.com/jaguaswift/statuses/104717... link pubdate 0 https://twitter.com/omarcostorres/statuses/104... 2018-10-02 13:04:29 1 https://twitter.com/cChantilly_/statuses/10471... 2018-10-02 13:04:29 2 https://twitter.com/det_thais/statuses/1047170... 2018-10-02 13:04:29 3 https://twitter.com/kittenburton/statuses/1047... 2018-10-02 13:04:29 4 https://twitter.com/jaguaswift/statuses/104717... 2018-10-02 13:04:28 author title 0 omarcostorres RT @carapanarana: Elei��es 2018 https://t.co/m... 1 cChantilly_ RT @lcbenedito: eu depois das elei��es quando ... 2 det_thais RT @CarlaZambelli17: Jair Bolsonaro tem um rec... 3 kittenburton RT @pedrolapera: Acho podre de chique quem diz... 4 jaguaswift RT @pisychoahs: minha tml s� temnVOTA NO CIRO... description source 0 Elei��es 2018 https://t.co/moQeYxQIY1 Twitter Web Client 1 eu depois das elei��es quando encontrar meus a... Twitter for Android 1
  2. 2. 2 Jair Bolsonaro tem um recado important�ssimo: ... Twitter for Android 3 Acho podre de chique quem diz que vai embora d... Twitter for Android 4 minha tml s� temnVOTA NO CIROnto amando kkkk Twitter for iPhone user_id profile_image_url 0 3640040781 https://pbs.twimg.com/profile_images/100676713... 1 4680224107 https://pbs.twimg.com/profile_images/104077952... 2 355073475 https://pbs.twimg.com/profile_images/966087526... 3 767938231 https://pbs.twimg.com/profile_images/104649465... 4 3809746342 https://pbs.twimg.com/profile_images/104640231... user_statuses_count user_friends_count user_followers_count 0 3454 172 185 1 907 489 226 2 17591 736 703 3 44920 839 1218 4 44368 5005 5607 user_created_at user_bio 0 2015-09-13 04:09:49 Este que vos fala. 1 2015-12-30 17:52:08 I'm in space... 2 2011-08-14 15:49:35 Deus acima de tudo/nnApreciadora de jogos, s... 3 2012-08-19 13:37:04 ich liebe dich sehr;; // ffc fcbm 2ne1 4 2015-09-28 21:46:58 esculpida pelo barro ganhou vida de Zeus user_location lang code coords 0 Brasil pt acdcbdc926fb18a130ddc207bd84a7ec NaN 1 NaN pt c6e5886486fc86ebd11950badf4b7d87 NaN 2 pt e986f05b838d64cf57316ff756b462f1 NaN 3 rj pt 064a0cbac0be403f49361febb83b71e1 NaN 4 wakanda pt 0145994e6cf04750456cf7589cb2c9a9 NaN In [20]: #as colunas da planilha elei��es.columns Out[20]: Index(['id', 'guid', 'link', 'pubdate', 'author', 'title', 'description', 'source', 'user_id', 'profile_image_url', 'user_statuses_count', 'user_friends_count', 'user_followers_count', 'user_created_at', 'user_bio', 'user_location', 'lang', 'code', 'coords'], dtype='object') In [21]: #As @ dos twitteiros que encabe�am da lista: elei��es["author"].head Out[21]: <bound method NDFrame.head of 0 omarcostorres 1 cChantilly_ 2 det_thais 2
  3. 3. 3 kittenburton 4 jaguaswift 5 ana_rc75 6 niaboktruk 7 MarthaFloresRo7 8 dbarbosa_99 9 diego_dfam 10 RafaelaLeite1D 11 tribunasertao 12 galo_2018 13 PeterMr 14 ninalawer 15 TribunaAgreste 16 MelSabbadini 17 Suhsanah 18 Bibilibi 19 WitcherPetricor 20 SmilerYounger 21 euricorfilho 22 juliasramalho 23 HiraiCabeyo 24 csbernar 25 corxinthians 26 darbio_rubem 27 jrtilt 28 DMGuedes1 29 joelalvarenga ... 99970 datnguyenemail 99971 GleyciEllen18 99972 fosterthetardis 99973 jackbianchi 99974 Carvalh37399456 99975 artheslovely 99976 Raafael_Gusmao 99977 NiloPimenta1 99978 FabianaMMendes 99979 SoQro_Ser_Feliz 99980 Htaudaciousoa 99981 seulhunz 99982 mariamsaenz18 99983 RadioProletrio 99984 CristinprofDos 99985 sep_caval 99986 k1000aplatanito 99987 RomulooBrasil 99988 teixeiradeia2 99989 Rocha_Ark 3
  4. 4. 99990 day_cc24 99991 cavalieri_ann 99992 DanielJorge79 99993 CavaleiroDoApo2 99994 Ana_Ducatti 99995 welderleutz 99996 CBarfifans 99997 Josesoa10827585 99998 Amisa_Mota 99999 carol_tdcf Name: author, Length: 100000, dtype: object> In [23]: #Seus seguidores em volume, do menor pro maior: elei��es["user_followers_count"].head() Out[23]: 0 185 1 226 2 703 3 1218 4 5607 Name: user_followers_count, dtype: int64 In [25]: #bio dos usu�rios elei��es["user_bio"].head() Out[25]: 0 Este que vos fala. 1 I'm in space... 2 Deus acima de tudo/nnApreciadora de jogos, s... 3 ich liebe dich sehr;; // ffc fcbm 2ne1 4 esculpida pelo barro ganhou vida de Zeus Name: user_bio, dtype: object In [ ]: 4

×