注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Computer Science

I Pressed My Words Here. Will You Read ?

 
 
 

日志

 
 

《社交网站的数据挖掘与分析》读书笔记1  

2013-01-30 23:52:15|  分类: 读书笔记 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
书名:社交网站的数据挖掘与分析
豆瓣评分:7.0分(227人评价)
博主评价:
未评价很差较差还行推荐力荐
来自豆瓣读书资源
绪论:Twitter数据的处理
Python开发工具的安装:http://www.python.org/download/
很不幸,刚装不久的Ubuntu12.04.1是自带了Python2.7的而且恰好和本书使用的版本一样。于是就直接忽略安装过程了。
示例1-1: 第一个真正的Python解释器会话
will@ubuntu12041:~$ print "Hello World"
Warning: unknown mime-type for "Hello World" -- using "application/octet-stream"
Error: no such file "Hello World"
will@ubuntu12041:~$ python
Python 2.7.3 (default, Aug  1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "Hello World"
Hello World
>>> #this is a comment
...
>>> for i in range(0,10):# a loop
...     print i, #the comma suppresses line breaks
...
0 1 2 3 4 5 6 7 8 9
>>> numbers = [i for i in range(0,10)] # a list comprehension
>>> print numbers
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> if 10 in numbers: # conditional logic
...     print True
... else:
...     print False
...
False
>>>

easy_install 是一个类似Linux系统中的包管理器的工具:http://pypi.python.org/pypi/setuptools中下载。其作用是安装Python包。
另:
will@ubuntu12041:~$ easy_install
The program 'easy_install' is currently not installed.  You can install it by typing:
sudo apt-get install python-setuptools
easy_install 在下载时没有进度提示。而另一管理工具pip在下载时有进度提示和日志信息。
will@ubuntu12041:~$ pip install networkx
Downloading/unpacking networkx
  Downloading networkx-1.7.zip (1.0Mb):  73%  757Kb
.......................
will@ubuntu12041:~$ sudo pip install networkx
[sudo] password for will:
Downloading/unpacking networkx
  Running setup.py egg_info for package networkx
   
    warning: no files found matching 'scripts/*'
    warning: no files found matching 'networkx/tests/*.txt'
    warning: no files found matching 'networkx/*/*/tests/*.txt'
    warning: no previously-included files matching '*~' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '.svn' found anywhere in distribution
    no previously-included directories found matching 'doc/build'
    no previously-included directories found matching 'doc/source/reference/generated'
    no previously-included directories found matching 'doc/source/examples'
    no previously-included directories found matching 'doc/source/static/examples'
    no previously-included directories found matching 'doc/source/templates/gallery.html'
Installing collected packages: networkx
  Running setup.py install for networkx
    deleting networkx.egg-info/requires.txt
   
    warning: no files found matching 'scripts/*'
    warning: no files found matching 'networkx/tests/*.txt'
    warning: no files found matching 'networkx/*/*/tests/*.txt'
    warning: no previously-included files matching '*~' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '.svn' found anywhere in distribution
    no previously-included directories found matching 'doc/build'
    no previously-included directories found matching 'doc/source/reference/generated'
    no previously-included directories found matching 'doc/source/examples'
    no previously-included directories found matching 'doc/source/static/examples'
    no previously-included directories found matching 'doc/source/templates/gallery.html'
Successfully installed networkx
Cleaning up...
will@ubuntu12041:~$


 安装成功networkx,在python中import它并根据示例1-2:
will@ubuntu12041:~$ python
Python 2.7.3 (default, Aug  1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import networkx
>>> g=networkx.Graph()
>>> g.add_edge(1,2)
>>> g.add_node("spam")
>>> print g.nodes()
[1, 2, 'spam']
>>> print g.edges()
[(1, 2)]
>>>



END
  评论这张
 
阅读(8)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017