可以從IronPython有效使用Deedle嗎?這樣做可能看起來很不合時宜,但看起來讓大熊貓完全從IronPython工作可能會很困難 - 有一些使用IronClad的非活動移植項目和方法,但不清楚是否有人已經成功地完成了IronClad。使用像Deedle這樣的純.NET解決方案似乎是一條更好的途徑。從IronPython使用deedle
1
A
回答
0
Deedle是一個標準的.NET庫。我對IronPython的瞭解有限,但我認爲它可以讓你使用.NET語言 - 所以它也適用於Deedle。 Deedle文檔has a number of examples showing how to use it from C#,因此如果您知道如何使用IronPython中的其他.NET庫,則應該能夠將C#示例轉換爲IronPython。
0
我個人的經驗是,試圖讓CPython庫(如熊貓)在Ironpython上工作是沒有用的。雖然there is a way to do it,它是非常不穩定和不可靠的。
Deedle似乎是下一個明顯的選擇,它的工作原理。您只需要添加對程序集的引用,並且還要注意IronPython如何處理泛型參數。
import clr;
import random;
from System import Tuple;
import itertools;
clr.AddReferenceToFileAndPath ("C:\\temp\\testedeedle\\packages\\FSharp.Core\\lib\\net40\\FSharp.Core.dll")
clr.AddReferenceToFileAndPath ("C:\\temp\\testedeedle\\packages\\Deedle\\lib\\net40\\Deedle.dll")
from Deedle import *
,那麼你可以創建一個與現有的API dataframes,如:
myPythonList = [("ID1", 1.1, 1.2),
("ID2", 1.1, 1.2),
("ID3", 1.1, 1.2),
("ID4", 1.1, 1.2)];
values = [[Tuple.Create[str,str,float](x[0], "FirstValue", x[1]), Tuple.Create(x[0], "SecondValue", x[2])] for x in myPythonList]
tupleList =list((itertools.chain(*values)))
frame = Frame.FromValues[str,str,float](tupleList);
FrameExtensions.Print(frame);
series_mult = frame.FirstValue + frame.SecondValue
print (series_mult)
frame2 = frame * 2
FrameExtensions.Print(frame2);
產量...
FirstValue SecondValue
ID1 -> 1.1 1.2
ID2 -> 1.1 1.2
ID3 -> 1.1 1.2
ID4 -> 1.1 1.2
series [ ID1 => 2.3; ID2 => 2.3; ID3 => 2.3; ID4 => 2.3]
FirstValue SecondValue
ID1 -> 2.2 2.4
ID2 -> 2.2 2.4
ID3 -> 2.2 2.4
ID4 -> 2.2 2.4
相關問題
- 1. Deedle:使用SaveCsv
- 2. Deedle:使用Frame.mapColValues
- 3. 從IronPython使用PyQt
- 4. 如何從IronPython使用win32api
- 5. F#Deedle過濾使用String.Contains
- 6. 使用pythonoglevoice與IronPython
- 7. 使用? F#中的運算符deedle
- 8. 「從IronPython的
- 9. 從IronPython的
- 10. (IronPython的)從C#
- 11. Deedle IndexRows type annotations
- 12. 從IronPython調用C#方法
- 13. 從IronPython調用Word.SaveAs方法
- 14. 一個Deedle框架
- 15. F#Deedle訪問行
- 16. Deedle正常化幀
- 17. C# - 在deedle系列
- 18. 在IronPython中使用Zxing.net
- 19. 在IronPython中使用pyVisa
- 20. 通過使用IronPython的
- 21. 在C#中使用IronPython#
- 22. 在IronPython中使用ILMerge
- 23. IronPython內存使用情況
- 24. 使用PTVS,IronPython和MongoDB
- 25. 使用IronPython中的ManagementClass.Getinstances()
- 26. 如何使用Ironpython請求?
- 27. 與monodroid使用IronPython - NotImplementedError
- 28. 如何使用COM/IronPython的
- 29. KeyNotFoundException調用IronPython
- 30. 如何從C#調用IronPython 2方法#
你見過[這個答案](HTTP:// stackoverflow.com/a/14443106/468244)?看起來像熊貓一樣沒有... –