Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python类型错误(数据类型(';<;U51';)_Python_Python 3.x_Pandas - Fatal编程技术网

Python类型错误(数据类型(';<;U51';)

Python类型错误(数据类型(';<;U51';),python,python-3.x,pandas,Python,Python 3.x,Pandas,我有一个数据帧,其最终输出是按一定顺序连接的单元格 目前我的代码如下 debit_creditquestionlist = ('Why is there a ' + df_credit[debit_credit] + ' in ' + df_credit[entity_name] + ' relating to ' + df_credit[account_name] + ' of ' + df_credit[amount] + ' at ') 目前,除了导致以下错误的df\u credit[

我有一个数据帧,其最终输出是按一定顺序连接的单元格

目前我的代码如下

debit_creditquestionlist = ('Why is there a ' + df_credit[debit_credit] + ' in ' + df_credit[entity_name] + ' relating to ' + df_credit[account_name] +  ' of ' + df_credit[amount] + ' at ')
目前,除了导致以下错误的
df\u credit[账户名称]
之外,其他都正常

TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U51') dtype('<U51') dtype('<U51')
TypeError:ufunc“add”不包含签名类型与dtype匹配的循环(“您可能需要执行以下操作:

df_credit[account_name].apply(str)
将向量的每个元素转换为字符串变量。否则:

 str(df_credit[account_name]) 
就是把整个向量转换成一个字符串,结果就像你得到的一样