Pandas单列应用功能错误

时间:2017-09-18 16:56:49

标签: python python-3.x pandas

当我使用下面的语句时,它会打印所有系列,然后抛出错误 dff_g.apply(func=print(dff_g['relationship_status']))

错误是

TypeError: ("'NoneType' object is not callable", 'occurred at index marriageId'

marriageId是数据框的第一列

我的更大目标是使用apply方法将多个列传递给函数。但这是我得到的一个基本错误

1 个答案:

答案 0 :(得分:0)

你可以尝试:

with fileinput.input(files=('file1.txt', 'file2.txt')) as f:
    for line in f:
        process(line)

将在所选列上应用print(),没有preshesis,因此传递实际函数而不是函数调用返回的值