簡體   English   中英

ufunc 'add' 不包含帶有簽名匹配類型的循環 (dtype('<u19'), dtype('int64')) -> 沒有任何</u19'),>

[英]ufunc 'add' did not contain a loop with signature matching types (dtype('<U19'), dtype('int64')) -> None

我正在嘗試使用 pandas 讀取 csv。這樣做時我收到以下錯誤:“ufunc 'add' 不包含具有簽名匹配類型的循環 (dtype('<U19'), dtype('int64')) - > 無”有人可以解釋為什么我得到這個以及它是什么意思嗎? 謝謝。

try:
    now = dt.datetime.now()
    print (now.strftime("%Y-%m-%d %H:%M:%S") + " : Reading data from the File now.")
    file_to_upload = pd.read_csv('D:/data/Desk/de-project/users.csv', delimiter=',')
    df_short = file_to_upload.head()
    now = dt.datetime.now()
    print(now.strftime("%Y-%m-%d %H:%M:%S") + df_short)
except Exception as e:
    now = dt.datetime.now()
    print(now.strftime("%Y-%m-%d %H:%M:%S") + ' : Error getting file: ' +  str(e))

我已經想通了。 問題出在印刷品 function 上:

print(now.strftime("%Y-%m-%d %H:%M:%S") + df_short)

在這里,'+' 運算符導致了問題,因為我試圖打印時間戳和 df。 這是不合邏輯的,因為您不能使用 df 添加時間戳值。

在這樣做的路上:

print(now.strftime("%Y-%m-%d %H:%M:%S") + 'Printing df')
print(df_short)

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')

UFuncTypeError:ufunc 'clip' 不包含具有簽名匹配類型的循環(dtype(' <u32’), dtype(‘<u32’), dtype(‘<u32’)) -> dtype(' <u32’)< div><div id="text_translate"><p> 我使用 Deep Pavlov 框架與 Bert 分類器一起工作,只是因為我需要預測人員的語言是俄語。 基本上,我正在嘗試解決多類分類問題。 根據 Deep Pavlov,我們可以輕松地更改配置文件上的一些配置。 我拿了這個配置文件<a href="https://github.com/deepmipt/DeepPavlov/blob/master/deeppavlov/configs/classifiers/rusentiment_convers_bert.json" rel="nofollow noreferrer">https://github.com/deepmipt/DeepPavlov/blob/master/deeppavlov/configs/classifiers/rusentiment_convers_bert.json</a>並訓練它,結果我花了大約 13 個小時才完成它我的 model 過擬合。</p><p> 我做了一些改變,尤其是這些:</p><pre> "weight_decay_rate": 0.001, "learning_rate_drop_patience": 1, "learning_rate_drop_div": 2.0, "load_before_drop": True, "min_learning_rate": 1e-03, "attention_probs_keep_prob": 0.5, "hidden_keep_prob": 0.5,</pre><p> 另外,我增加了批量大小,之前是 16:</p><pre> "batch_size": 32</pre><p> 並添加了一些指標:</p><pre> "log_loss", "matthews_correlation",</pre><p> 還將validation_patience更改為1並添加了tensorboard func</p><pre> "validation_patience": 1, "tensorboard_log_dir": "logs/",</pre><p> 就是這樣。 這些是我對 model 所做的所有更改,當我嘗試訓練我的 model 時,它給了我以下錯誤:</p><pre> UFuncTypeError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py in _wrapfunc(obj, method, *args, **kwds) 60 try: ---&gt; 61 return bound(*args, **kwds) 62 except TypeError: 15 frames UFuncTypeError: ufunc 'clip' did not contain a loop with signature matching types (dtype('&lt;U32'), dtype('&lt;U32'), dtype('&lt;U32')) -&gt; dtype('&lt;U32') During handling of the above exception, another exception occurred: UFuncTypeError Traceback (most recent call last) &lt;__array_function__ internals&gt; in clip(*args, **kwargs) /usr/local/lib/python3.7/dist-packages/numpy/core/_methods.py in _clip_dep_invoke_with_casting(ufunc, out, casting, *args, **kwargs) 83 # try to deal with broken casting rules 84 try: ---&gt; 85 return ufunc(*args, out=out, **kwargs) 86 except _exceptions._UFuncOutputCastingError as e: 87 # Numpy 1.17.0, 2019-02-24 UFuncTypeError: ufunc 'clip' did not contain a loop with signature matching types (dtype('&lt;U32'), dtype('&lt;U32'), dtype('&lt;U32')) -&gt; dtype('&lt;U32')</pre><p> 起初,我認為它與數據集有關,但是,我沒有更改我的數據集,並且在我第一次訓練這個 model 時它已經運行。 </p></div></u32’)<></u32’),>

[英]UFuncTypeError: ufunc ‘clip’ did not contain a loop with signature matching types (dtype(‘<U32’), dtype(‘<U32’), dtype(‘<U32’)) -> dtype(‘<U32’)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

相關問題 numpy.core._exceptions.UFuncTypeError:ufunc &#39;add&#39; 不包含簽名匹配類型的循環(dtype(&#39;<U20'), dtype('int64')) -> 無 ufunc&#39;add&#39;不包含簽名匹配類型為dtype(&#39; 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')> ufunc &#39;add&#39; 不包含簽名匹配類型 dtype 的循環 類型錯誤:ufunc &#39;add&#39; 不包含簽名匹配類型 dtype(&#39; TypeError:ufunc&#39;add&#39;不包含簽名匹配類型為dtype(&#39;的循環 類型錯誤:ufunc &#39;add&#39; 不包含具有簽名匹配類型的循環 (dtype(&#39; <U21'), dtype('<U21')) -> 數據類型(&#39; TypeError:ufunc&#39;add&#39;不包含簽名匹配類型為dtype(&#39;的循環 Keras PREDICTION拋出&#39;TypeError:ufunc&#39;add&#39;不包含簽名匹配類型為dtype(&#39;的循環 UFuncTypeError:ufunc 'clip' 不包含具有簽名匹配類型的循環(dtype(' <u32’), dtype(‘<u32’), dtype(‘<u32’)) -> dtype(' <u32’)< div><div id="text_translate"><p> 我使用 Deep Pavlov 框架與 Bert 分類器一起工作,只是因為我需要預測人員的語言是俄語。 基本上,我正在嘗試解決多類分類問題。 根據 Deep Pavlov,我們可以輕松地更改配置文件上的一些配置。 我拿了這個配置文件<a href="https://github.com/deepmipt/DeepPavlov/blob/master/deeppavlov/configs/classifiers/rusentiment_convers_bert.json" rel="nofollow noreferrer">https://github.com/deepmipt/DeepPavlov/blob/master/deeppavlov/configs/classifiers/rusentiment_convers_bert.json</a>並訓練它,結果我花了大約 13 個小時才完成它我的 model 過擬合。</p><p> 我做了一些改變,尤其是這些:</p><pre> "weight_decay_rate": 0.001, "learning_rate_drop_patience": 1, "learning_rate_drop_div": 2.0, "load_before_drop": True, "min_learning_rate": 1e-03, "attention_probs_keep_prob": 0.5, "hidden_keep_prob": 0.5,</pre><p> 另外,我增加了批量大小,之前是 16:</p><pre> "batch_size": 32</pre><p> 並添加了一些指標:</p><pre> "log_loss", "matthews_correlation",</pre><p> 還將validation_patience更改為1並添加了tensorboard func</p><pre> "validation_patience": 1, "tensorboard_log_dir": "logs/",</pre><p> 就是這樣。 這些是我對 model 所做的所有更改,當我嘗試訓練我的 model 時,它給了我以下錯誤:</p><pre> UFuncTypeError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py in _wrapfunc(obj, method, *args, **kwds) 60 try: ---&gt; 61 return bound(*args, **kwds) 62 except TypeError: 15 frames UFuncTypeError: ufunc 'clip' did not contain a loop with signature matching types (dtype('&lt;U32'), dtype('&lt;U32'), dtype('&lt;U32')) -&gt; dtype('&lt;U32') During handling of the above exception, another exception occurred: UFuncTypeError Traceback (most recent call last) &lt;__array_function__ internals&gt; in clip(*args, **kwargs) /usr/local/lib/python3.7/dist-packages/numpy/core/_methods.py in _clip_dep_invoke_with_casting(ufunc, out, casting, *args, **kwargs) 83 # try to deal with broken casting rules 84 try: ---&gt; 85 return ufunc(*args, out=out, **kwargs) 86 except _exceptions._UFuncOutputCastingError as e: 87 # Numpy 1.17.0, 2019-02-24 UFuncTypeError: ufunc 'clip' did not contain a loop with signature matching types (dtype('&lt;U32'), dtype('&lt;U32'), dtype('&lt;U32')) -&gt; dtype('&lt;U32')</pre><p> 起初,我認為它與數據集有關,但是,我沒有更改我的數據集,並且在我第一次訓練這個 model 時它已經運行。 </p></div></u32’)<></u32’),>
 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM