私信  •  关注

foobar

foobar 最近创建的主题
foobar 最近回复了
7 年前
回复了 foobar 创建的主题 » 请帮助新手使用函数定义python

缩进在Python中很重要。确保代码缩进正确:

def two_teams(sailors):

    sailors ={'Smith': 34,'Wesson': 22,'Coleman': 45,'davies' : 50,'Abrahams': 19,'Toms': 23}                                                                                                                           

    firstShip =[]

    secondShip = []

    for i in sailors.keys():
        if sailors[i] > 40 or sailors[i] < 20:
            firstShip.append(i)
            firstShip.sort()
        else:
            secondShip.append(i)
            secondShip.sort()

    return [
        [firstShip],
        [secondShip]
    ]
16 年前
回复了 foobar 创建的主题 » 您的财务“必备”python包是什么?

http://code.google.com/p/pandas/ 也是以定量金融背景发展起来的。

我想通常的嫌疑犯是:

  • 麻木的
  • 斯皮皮
  • RPY
  • Mat普特利布
  • …

对于我的定量发展,我通常从pythonxy开始。( http://www.pythonxy.com/ )作为基础。

在过去,我还为Quantlib使用了一些Python绑定。(我不知道它们是否还在开发中)。