数据框中的一列是icno(下面),它是成员的国家识别卡号码。我正在尝试创建另一个专栏,用function和apply方法嗅出前面带有'S'的那些。但我收到了下面的错误信息。有人能指出问题吗?谢谢!在
def f(x):
if x['IC No_'].str.startswith('S',na=False): return 1
else : return 0
MbrKPI['Sing']=MbrKPI.apply(f,axis=1)
AttributeError: ("'float' object has no attribute 'str'", 'occurred at index 0')
改变
相关问题 更多 >
编程相关推荐