PyThorPython 集成 R 語言
RPy2 可以在 Python 和 R 之間進行交互,讓用戶可以在 Python 中輕松的使用 R 的封裝包。
Python 一般用來進行數(shù)據(jù)分析,但是許多的包只存在于 R 語言中。所以,在 Python 與 R 中進行互通非常重要。
Pythor 包含使用 RPY2 的方法,還可以編寫 R 包的封裝。
線性模型的 R 代碼示例:
fit <- lm('eruptions ~ waiting', data=faithful_geyser)
predicted <- predict(fit, newdata=tail(faithful_geyser))
使用 Pythor 之后的 Python 代碼:
pylm = PYLM() relationship='eruptions~waiting' pylm.fit(relationship, faithful_pandas_df) pylm.predict(faithful_pandas_df.tail(5))
評論
圖片
表情
