![](/img/trans.png)
[英]Processing a Python dictionary
假設我有一個與此類似的字典,其中包含變量 ID 和 PosX: 我想遍歷所有這些並創建一個新字典來存儲這樣的數據: 基本上將具有匹配 ID 的每個 Dict 條目的列表一起存儲在一對類型 ID,數據中我嘗試使用 function 首先創建一個 ID 列表(我有多個),然后根據匹配的 ID 再次迭代數 ...
[英]Processing a Python dictionary
假設我有一個與此類似的字典,其中包含變量 ID 和 PosX: 我想遍歷所有這些並創建一個新字典來存儲這樣的數據: 基本上將具有匹配 ID 的每個 Dict 條目的列表一起存儲在一對類型 ID,數據中我嘗試使用 function 首先創建一個 ID 列表(我有多個),然后根據匹配的 ID 再次迭代數 ...
[英]Delete multiple variables in Python 3 independently if they exist or not
使用del a, b, c如果所有變量a, b, c都存在,我可以一次刪除 3 個變量。 但是,如果變量不存在,我會收到錯誤消息。 如果我想刪除變量a, b, c我可以事先手動檢查它是否存在: 這非常麻煩,因為我經常要刪除多個變量。 有沒有更舒服的類似於del a, b, c ? 為什么要刪除變量? ...
[英]Import .spydata files to Spyder
我正在嘗試將 some.spydata 文件導入 Spyder(來自 Anaconda),但彈出“問題報告器”window,上面寫着:“Spyder 遇到內部問題!” 此外,在 Consol 中存在以下錯誤:TypeError: () takes 1 positional argument but ...
[英]Module not Found error. Keeps coming up even though they are already installed
我一直在研究將股票數據傳輸到 excel 電子表格的代碼。 該代碼在 spyder 中有效,但當我在 CMD 中運行它時,我收到有關我的庫的以下錯誤消息。 即使清楚地安裝了錯誤信息。 我的 IDE 和 CMD 都安裝好了。 我試過卸載並重新安裝,但除此之外我完全迷路了。 編碼新手。 ...
[英]How to fix “No Module name pyspark” from exe
我使用 spyder IDE 在 Pyspark/python 中創建了一個程序。程序正在使用 Pyspark 庫,當我從 IDE SPYDER 運行它時,它運行完美。 我使用 pyinstaller 創建了相同程序的 exe。 當我從命令提示符運行 exe 時,出現錯誤“No module na ...
[英]In line 12,13,14 how can i write code by using f string, without using spaces in f string but in output there must be space between string
我正在寫的代碼我試圖刪除空間,但它沒有給我所需的output.output,我想要在 f 字符串中不使用空間 ...
[英]Is it possible to automate the process of running different python scripts in separate Spyder consoles?
我發現在 Spyder 中跨單獨的控制台 windows 運行不同的代碼是並發執行代碼的便捷方式。 我總是“手動”完成此操作(點擊新的控制台按鈕,然后在該控制台中啟動所需的代碼段)。 但是,我想知道是否有一種方法可以自動執行此過程(或以自動方式實現相同的效果,即具有單獨命名空間的並發代碼)。 通過 ...
[英]i can't apply labelencoder to array of bool
我在做一個機器學習項目。 我確實導入了所有庫。 我拿了一列數據(這一列是 bool 數組),我想應用它 labelencoder。 這是我的全部代碼。 這是我得到的錯誤。 ...
[英]I want to keep the last two letters if its "ub"
該代碼的目標是在任何元音 (klinker) 之前添加 ub 到一個新句子 (nieuwe_zin)。 或解碼句子。 我想添加一個功能,如果 zin(句子)中的最后 2 個字符是“ub”,則在解碼時它們不會被刪除。 所以像 club 這樣的詞不會變成 cl。 我試過了 if zin[i:-2] == ...
[英]Spyder console value different than in the Editor
對於工作/學習項目,我一直在從 JupiterLab 和 NOtebook 過渡到 Spyder,以利用 Spyder 包含的調試器(在其他 2 個 IDE 中缺失)。 在嘗試運行我的前幾行代碼時,我注意到控制台中的代碼顯示了一些與我在編輯器中編寫的不同的部分。 具體來說,我嘗試將測試列表切片為 L ...
[英]Python ruamel.yaml code works in console but not in function (spyder)
我在 Spyder 工作,Python 3.9 版。 我遇到了一個問題,我在 function 中編寫的一些代碼無法正常工作,但是在控制台中運行代碼時,我得到了預期的結果。 我正在嘗試編寫一個 function,它從列表中獲取項目並將它們寫入 YAML 文件。 當代碼在 function 時,我會得 ...
[英]how can i call the file testo.txt, directly from the function argument? what's a more pythonic way?
如果我只是把 'testo.txt' id 作為參數扔給我: 什么是更全局的解決方案,而不必進行整個路徑分配? 獎金問題:我在哪里可以學習在我的編程中更加 pitonic 而不是像堆棧溢出中的垃圾郵件問題? 謝謝獎金問題:我在哪里可以學習在我的編程中更加 pitonic 而不是像堆棧溢出中的垃圾郵 ...
[英]How to set and reference date range in Python and then apply to a query?
這就是我想在 Spyder 中做的 我收到錯誤 Could not cast literal "{start_date}" to type DATE at [3:49] 如何在查詢中僅引用 python 中的代碼? 似乎很難找到答案我需要在 python 中設置一個固定日期,這樣我就不必更改在 p ...
[英]Spyder 5.3.3 crashes on startup, while loading environment
Redhat8、Anaconda3 上的 Spyder 5.3.3 在加載環境變量時崩潰: ...文件“/home/user/anaconda3/envs/p311/lib/python3.11/site-packages/spyder/plugins/pythonpath/utils.py”, ...
[英]How to use pip install to install lazypredict (Python package) using a MacOS Ventura 13.1, using Spyder
這些是我的代碼: 而且,我收到此錯誤: ...
[英]How do I set up the environment on Spyder to work with PLAXIS?
我目前正嘗試在 Anaconda 上設置我的 Spyder 以連接 PLAXIS。 但是,我不確定該怎么做,也無法在網上找到分步指南。 我試圖將 Python 解釋器更改為 Bentley 文件夾中的 python.exe,但錯誤提示“未安裝 spyder-kernels”。 我試圖創建另一個環境 ...
[英]Why Python stops to work on GPU when using SimpleITK library in MONAI transforms?
我將 Python 3.9 與 Spyder 5.2.2 (Anaconda) 一起用於 MONAI 的 U-Net 分割任務。 將所有圖像導入字典后,我創建了這些行來定義預處理步驟: 當我用 Compose 回憶起這些變換並將它們應用於火車圖像時,python 對 GPU 不起作用,盡管 返回真 ...
[英]System of 4 equations with Sympy
我正在嘗試用非定義常量求解具有四個未知數的 4 個方程組,但是當我在 Spyder 中運行我的程序時,consol 顯示“解決方案”而沒有給出解決方案。 這就是我所擁有的 In[54]: runfile('E:/Spyder/eigen_functions.py', wdir='E:/Spyder' ...
[英]Why is the output of "complex(20+10j,5+5j),complex(10+10j,5+5j)" as "(15+15j),(5+15j)" and explain with more examples?
為什么 (31+5j.real) 的 output 是 31.0 而 (31+5j.imag) 是 36.0? 為什么 (42.real) 的 output 是 42 而 (42.imag) 是 42? 為什么 (complex(20+10j,5+5j)) 的 output 是 ((15+15j) ...
[英]Scraping specific pdfs from different websites
第一個問題在這里。 我需要從每個 url 下載特定的 pdf。我只需要從我擁有的每個 url 中下載歐盟委員會提案的 pdf,它始終位於頁面的特定部分 [這里是我在 pdf 表格中始終需要的網站部分]。 歐盟委員會提案這是它的 html 代碼(我感興趣的部分是: “http://www.euro ...