繁体   English   中英

Seaborn TypeError: No loop match the specified signature and cast was found for ufunc add when using hue

[英]Seaborn TypeError: No loop matching the specified signature and casting was found for ufunc add when using hue

我正在尝试使用 Seaborn 获得联合图。 我的 dataframe 有三列,看起来像这样

     Sample        pT Multiplicity
0      Jet1  132.2770           31
1      Jet1  181.0730           44
2      Jet1  118.1880           32
3      Jet1  155.7290           40
4      Jet1  250.8600           25
...     ...       ...          ...
1995   Jet2  134.8610           25
1996   Jet2  192.9830           58
1997   Jet2  176.5910           33
1998   Jet2   60.8583           29
1999   Jet2  158.0140           54

当我尝试使用以下行sns.jointplot(x="pT", y="Multiplicity", hue="Sample", data=df)

我遇到错误TypeError: No loop matching the specified signature and casting was found for ufunc add

我曾尝试使用分类变量,但无济于事。 当我不使用 'hue' 选项时,我不会遇到任何错误。

对象的数据类型是

Sample           object
pT              float64
Multiplicity     object
dtype: object

请帮忙! 谢谢

您的代码中没有任何问题。 但是您的 Multiplicity dtype 必须是 int64。

df['Multiplicity'] = df['Multiplicity'].astype(int)

TypeError: ufunc 'add' 不包含签名匹配类型 dtype(' <u1') dtype('<u1') dtype('<u1')< div><div id="text_translate"><p> 我是 Python 用户的初学者。 当我尝试在下面编写代码时发生错误</p><pre>import numpy as np np.array(['a', 'b', 'c']) + np.array(['d','e', 'f'])</pre><pre> TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('&lt;U1') dtype('&lt;U1') dtype('&lt;U1')</pre><p> 所以我尝试设置dtype = '&lt;U1' ,但它没有用</p><pre>import numpy as np np.array(['a', 'b', 'c'], dtype='&lt;U1') + np.array(['d','e', 'f'], dtype='&lt;U1')</pre><p> 如何无错误地连接那些 np.arrays ?</p></div></u1')>

[英]TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U1') dtype('<U1') dtype('<U1')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Pearsonr:TypeError:没有找到与指定签名匹配的循环,并且为 ufunc add 找到了转换 调用 func pearsonr 和 Got TypeError: 没有找到匹配指定签名和转换的循环用于 ufunc add np.linalg.lstsq(X,Y)[0] - TypeError: No loop match the specified signature and cast was found for ufunc lstsq_n 类型错误:ufunc &#39;add&#39; 不包含具有签名匹配类型的循环 获取没有匹配指定签名和转换错误的循环 UFuncTypeError:在列表中添加元素时,ufunc&#39;add&#39;不包含具有签名匹配类型的循环 ufunc &#39;add&#39; 不包含签名匹配类型 dtype 的循环 TypeError:ufunc&#39;add&#39;不包含带有ARIMA模型签名的循环 TypeError: ufunc 'add' 不包含签名匹配类型 dtype(' <u1') dtype('<u1') dtype('<u1')< div><div id="text_translate"><p> 我是 Python 用户的初学者。 当我尝试在下面编写代码时发生错误</p><pre>import numpy as np np.array(['a', 'b', 'c']) + np.array(['d','e', 'f'])</pre><pre> TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('&lt;U1') dtype('&lt;U1') dtype('&lt;U1')</pre><p> 所以我尝试设置dtype = '&lt;U1' ,但它没有用</p><pre>import numpy as np np.array(['a', 'b', 'c'], dtype='&lt;U1') + np.array(['d','e', 'f'], dtype='&lt;U1')</pre><p> 如何无错误地连接那些 np.arrays ?</p></div></u1')> 为什么 numpy 在尝试预测回归时会引发异常错误:“ufunc'add'没有包含签名匹配类型的循环”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM