Python报错问题:'must be str, not float', 'occurred at index 0'

limit_1 = stockdata.loc[:, 'RS_of_AS(10,000)']
manager_1 = stockdata.loc[:,'NOSH_Executive_ALL']
data = pd.DataFrame({'a':limit_1,'b':manager_1})
data['Total_sum'] = df.apply(lambda x: x.sum(), axis=1)

返回错误:TypeError: ('must be str, not float', 'occurred at index 0')
求大神告知怎么破解。

本来是要求列的相加,相除,但是这数据死活报错,快疯了

第1个回答  2018-11-04
import random name = input("Please enter your name:")name = name.strip()first_name, last_name = name.split()index = str(random.randint(0, 999))user_name = first_name[0].lower() + last_name[0:3].lower() + index.zfill(3)print('Your username is', user_name)
第2个回答  2018-10-06
pd,np 之类的模块重写了四则运算,要调用相关函数,不能直接乘除追问

麻烦问下怎么解决?

第3个回答  2018-10-05
1、Python中’Nonetype’ object is not iterable的问题
None 值被赋给了多个变量,如下
a, b = None
该对象的值为None,可能被赋值的时候出现问题(源数据为None)
*当一个函数没有return语句,函数会返回None,此时如果将函数返回值赋给多个变量,则容易出现上述错误。

2、TypeError: can’t compare datetime.date to NoneType

3、Warning: Data truncated for column ‘end_collect_time’ at row 1
end_collect_time值类型与数据库中的值的类型不匹配

4、(1064, “You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘)’ at line 1”)
sql 语法错误,sql中某个条件为空了
例如:where id in ()

5、(1054, “Unknown column ‘None’ in ‘field list’”)
往数据库中插入数据的时候,某些数据为Nonde

6、函数在没有返回值时 默认返回None

7、Warning: Data truncated for column ‘end_collect_time’ at row 1
cursor_test.execute(sql_insert)
由于插入的数据格式与数据库中的数据格式不匹配造成的追问

麻烦问下怎么解决

本回答被网友采纳