递归Python函数不返回D

2024-04-24 04:33:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个递归函数

def boost_test(frame, iteration, max_iteration):
    if iteration < max_iteration:
        print iteration, max_iteration
        # get predictions
        iteration += 1
        boost_test(frame, iteration, max_iteration)
    elif iteration == max_iteration:
        print 'return frame', iteration, max_iteration, frame.columns
        #print frame
        return frame

我可以这样做:

^{2}$

输出如下: 0 5个 15 2 5个 3 5个 4 5个 返回帧5 5索引([u'hello'],dtype='object')

看来一切都是对的。但是如果它看起来不像是在返回一个帧。在

当我尝试的时候 n、 头()

我得到:

AttributeError: 'NoneType' object has no attribute 'head'

我不知道它为什么不返回数据帧。任何帮助都是非常感谢的。谢谢!在


Tags: columnstesthellogetreturnifobjectdef