CODE:

#!/usr/bin/python
# -*- coding: utf-8 -*- '''
Created on 2014-7-10
@author: guaguastd
@name: retweet_frequency_map.py
''' if __name__ == '__main__': # import visualize
from visualize import visualize_frequency_map # pip install prettytable
# from prettytable import PrettyTable # import search
from search import search_for_tweet # import login, see http://blog.csdn.net/guaguastd/article/details/31706155
from login import twitter_login # get the twitter access api
twitter_api = twitter_login() # import tweet
from tweet import popular_retweets while 1:
query = raw_input('\nInput the query (eg. #MentionSomeoneImportantForYou, exit to quit): ') if query == 'exit':
print 'Successfully exit!'
break statuses = search_for_tweet(twitter_api, query)
retweets = popular_retweets(statuses)
counts = [count for count, _, _ in retweets]
sTitle = "Retweets"
xLabel = "Bins (number of times retweeted)"
yLabel = "Number of tweets in bin"
visualize_frequency_map(counts, sTitle, xLabel, yLabel)

RESULT:

Input the query (eg. #MentionSomeoneImportantForYou, exit to quit): #MentionSomeoneImportantForYou
Length of statuses 95 Input the query (eg. #MentionSomeoneImportantForYou, exit to quit):

Python 对Twitter中指定话题的被转载Tweet数量的频谱分析的更多相关文章

  1. Python 对Twitter中指定话题的Tweet基本元素的频谱分析

    CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-9 @author: guaguastd @name: en ...

  2. Python 可视化Twitter中指定话题中Tweet的词汇频率

    CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-8 @author: guaguastd @name: pl ...

  3. Python 查找Twitter中特定话题中最流行的10个转发Tweet

    CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-4 @author: guaguastd @name: fi ...

  4. python 统计字符串中指定字符出现次数的方法

    python 统计字符串中指定字符出现次数的方法: strs = "They look good and stick good!" count_set = ['look','goo ...

  5. python提取mysql中指定列参数,并循环打印

    试验环境: Python 3.7.0 Mysql 5.0 实验目的: 使用python将数据库中指定的列中的数值取出来,并循环遍历,用以当成参数传递给需要它的方法. 本次实验取的是para列的数据 实 ...

  6. 用 python 修改文件中指定的行数

    #! /bin/python filename='setup.ini' lines=[] with open(filename,'r') as f: lines=f.readlines() lines ...

  7. python 删除文件中指定行

    代码适用情况:xml文件,循环出现某几行,根据这几行中的某个字段删掉这几行这段代码的作用删除jenkins中config.xml中在自动生成pipline报错的时的回滚 start = '<se ...

  8. python返回列表中指定内容的索引

    import numpy as npa=[2,10,2,3,4,10,10]ans = np.where(np.array(a)==10)print(ans) 结果是:(array([1, 5, 6] ...

  9. Python获取list中指定元素的索引

    在平时开发过程中,经常遇到需要在数据中获取特定的元素的信息,如到达目的地最近的车站,橱窗里面最贵的物品等等.怎么办?看下面 方法一: 利用数组自身的特性 list.index(target), 其中a ...

随机推荐

  1. BZOJ 1880: [Sdoi2009]Elaxia的路线( 最短路 + dp )

    找出同时在他们最短路上的边(dijkstra + dfs), 组成新图, 新图DAG的最长路就是答案...因为两人走同一条路但是不同方向也可以, 所以要把一种一个的s,t换一下再更新一次答案 ---- ...

  2. Intellij IDEA 常用 设置 及 快捷键 (持续更新)

    Transparent native-to-ascii conversion以下设置都可以通过 设置中的搜索框 进行关键字搜索 0, 打开Project 设置 Command + ; 1, 打开Mod ...

  3. 高级UNIX环境编程5 标准IO库

    标准IO库都围绕流进进行的 <stdio.h><wchar.h> memccpy 一般用汇编写的 ftell/fseek/ftello/fseeko/fgetpos/fsetp ...

  4. VC++对象布局的奥秘:虚函数、多继承、虚拟继承

    哈哈,从M$ Visual C++ Team的Andy Rich那里又偷学到一招:VC8的隐含编译项/d1reportSingleClassLayout和/d1reportAllClassLayout ...

  5. Windows Phone 8初学者开发—第3部分:编写第一个Windows Phone 8应用程序

    原文 Windows Phone 8初学者开发—第3部分:编写第一个Windows Phone 8应用程序 原文地址: http://channel9.msdn.com/Series/Windows- ...

  6. @Autowired与@Resource的差别

    1.@Autowired与@Resource都能够用来装配bean. 都能够写在字段上,或写在setter方法上. 2.@Autowired默认按类型装配(这个注解是属业spring的),默认情况下必 ...

  7. android-改进&lt;&lt;仿QQ&gt;&gt;框架源代码

    该文章主要改动于CSDN某大神的一篇文章,本人认为这篇文章的面向对象非常透彻,以下分享例如以下可学习的几点: Android应用经典主界面框架之中的一个:仿QQ (使用Fragment, 附源代码) ...

  8. DataTable的属性与使用方式

    一.DataTable简介 (1)构造函数            DataTable()   不带参数初始化DataTable 类的新实例.            DataTable(string t ...

  9. [Swust OJ 715]--字典序问题(组合数预处理/数位dp)

    题目链接:http://acm.swust.edu.cn/problem/715/ Time limit(ms): 1000 Memory limit(kb): 65535   在数据加密和数据压缩中 ...

  10. 应用之间进行跳转,ComponentName的方式

    从应用A跳转到应用B, 关键代码如下: 有以下几个注意点: 1.ComponentName cn = new ComponentName("com.terry", "co ...