Tableau与R Server的Python连接

1 投票
2 回答
1172 浏览
提问于 2025-04-18 16:58

我最近发现可以在Tableau中使用R语言,来返回布尔值、整数、长整型等。这是通过以下方式实现的:

install.packages("Rserve")
library(Rserve)
Rserve()
// Should say "Starting RServe..."

然后在Tableau中:

// For Tableau under 'Help' > 'Settings and Performance' > 'Manage R Connections'
// Server: 127.0.0.1 and Port:6311
// Make sure that 'RStudio' with 'RServer' is installed and running prior to Tableau connection

不过我想用Python做同样的事情,也就是说希望在Tableau中使用Python脚本(而不是通过Tableau的API在Python中使用)——有没有人知道这是否可行?上面的代码片段来自于这里

2 个回答

1

从Tableau 10.1版本开始,推出了一个新的工具包/库,叫做TabPy。它的作用类似于Rserver,可以帮助将R语言与Tableau结合起来。

值得一看这篇文章: https://www.tableau.com/about/blog/2017/1/building-advanced-analytics-applications-tabpy-64916

1

在Tableau 8.2版本中,除了R语言之外,没有其他语言的Script()调用。

你可以尝试用R作为中介,通过rPython或RSPython这两个包来调用Python的功能。我不太确定这样做的效率如何,但如果你有一些在R中无法使用的重要Python库,这样做可能是值得的。

撰写回答