簡體   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