Friday, 19 March 2010

my Poisson simulation

my Poisson simulation

2010-03-19 12:21:02

Monday, 8 March 2010

possion function example (from scipy)

>>> from scipy.stats import poisson, lognorm >>> myShape = 5;myMu=10 >>> ln = lognorm(myShape) >>> p = poisson(myMu) >>> ln.rvs((10,)) generate 10 RVs from ln array([ 2.09164812e+00, 3.29062874e-01, 1.22453941e-03, 3.80101527e+02, 7.67464......

Friday, 26 February 2010

导出 豆瓣 日记 到其他Blog和twitter

导出 日记 到其他blog: 豆瓣日记 -> twitterfeed -> -> blogger/wordpress 导出 广播 到twitter: 豆瓣广播 -> feedburner -> twitter (->facebook) 豆瓣广播 到 新浪微博: 豆瓣广播 -> google reader (add star) stared -> 新浪微博(关联博客)

Monday, 11 January 2010

[Blog post] python reads excel

python reads excel

crossz | January 11, 2010 at 1:12 am | Tags: python tutorial howto | Categories: life | URL:

Use the excellent xlrd package, which works on any platform. That means you can read Excel files from Python in Linux! Example usage:

Open the workbook

import xlrd wb = xlrd.open_workbook('myworkbook.xls')

Check the sheet names


Get the first sheet either by index or by name

sh = wb.sheet_by_index(0) sh = wb.sheet_by_name(u'Sheet1')

Iterate through rows, returning each as a list that you can index:

for rownum in range(sh.nrows):     print sh.row_values(rownum)

If you just want the first column:

first_column = sh.col_values(0)

Index individual cells:

cell_A1 = sh.cell(0,0).value cell_C4 = sh.cell(rowx=3,colx=2).value

(Note Python indices start at zero but Excel starts at one)

Add a comment to this post


WordPress | Thanks for flying with WordPress!

Manage your subscriptions | Publish text, photos, music, and videos by email using our Post by Email feature. | Signup with

My photo
London, United Kingdom

Facebook & Twitter