按照 PyCall.jl readme 上的说明,在我的 julia 项目(在它自己的环境中)使用 PyCall 时,我打算使用 pipenv python。
在终端中,我使用 激活了python环境pipenv shell,然后找到了pipenv版本的python的路径文件。PyCall 已添加到我的 julia 环境中的清单中。在源代码激活的终端中,我启动 Julia 并输入:ENV["PYCALL_JL_RUNTIME_PYTHON"] = pipenv python environment然后继续运行Pkg.build("PyCall"),安装 conda。导入 PyCall 时 - using PyCall- 我收到以下错误。
ERROR: InitError: Incompatible `libpython` detected.
`libpython` for C:\Users\me\.virtualenvs\iap\Scripts\python.exe is:
C:\Users\me\.virtualenvs\iap\Scripts\python37.dll
`libpython` for C:\Users\me\.julia\conda\3\python.exe is:
C:\Users\me\.julia\conda\3\python36.dll
PyCall.jl only supports loading Python environment using the same `libpython`
Run Code Online (Sandbox Code Playgroud)
我试过重新安装 PyCall,但是 python 环境 libpython 总是抛出这个错误。我如何覆盖或以其他方式解决 base julia 的 conda 要求?
我有一种感觉,PyCall 的 Conda 依赖项导致了一些libpython …
我有一个字符串:
Hi there, "Bananas are, by nature, evil.", Hey there.
Run Code Online (Sandbox Code Playgroud)
我想用逗号作为分隔符分割字符串。如何让 .split 方法忽略引号内的逗号,以便它返回 3 个字符串而不是 5 个。
我的服务器->
output$finaltable2 <- renderUI({
if(is.null(input$check)) {return()}
else
tabsetPanel(
tabPanel("Q Bins", renderPlot(replayPlot(qplot), height = 600)),
tabPanel("P Value Histogram", renderPlot(replayPlot(tplot), height = 600)),
tabPanel("Q Value to Use", h3(toString(qaverage)))
)
Run Code Online (Sandbox Code Playgroud)
})
取出replayPlot()并在中调用qplot / tplot对象renderPlot()也可以:
output$finaltable2 <- renderUI({
if(is.null(input$check)) {return()}
else
tabsetPanel(
tabPanel("Q Bins", renderPlot(qplot, height = 600)),
tabPanel("P Value Histogram", renderPlot(tplot, height = 600)),
tabPanel("Q Value to Use", h3(toString(qaverage)))
)
})
Run Code Online (Sandbox Code Playgroud)
我的qplot和tplot对象是通过以下方式制作的:
plot.new()
par(mfrow=c(3,4))
barplot(df[[1]][[2]])
*etc, etc, etc [adding more subplots to plot]*
qplot <- recordPlot()
Run Code Online (Sandbox Code Playgroud)
也许Shinyapps Linux服务器不喜欢recordPlot()结构;有没有其他方法可以记录我的绘图数据并在output $ …
我无法找到包含数据类的哈希集数组的交集(我想通过标识符进行相交):
class Protein(val id: String, val score: Double, val molw: Double, val spc: Int)
Run Code Online (Sandbox Code Playgroud)
我已将 .csv 文件中的一些数据提取到这种类型的结构中:
ArrayList<HashSet<Protein>>
Run Code Online (Sandbox Code Playgroud)
因此,我有六个数组列表 [每个 csv 1 个],每个列表都包含一个包含数千个蛋白质结构的哈希集。到目前为止,我尝试根据常见 Protein.id 获取交集 HashSet:
fun intersection(data: ArrayList<HashSet<Protein>>): HashSet<Protein> {
val intersectionSet = HashSet<Protein>(data[0])
for (i in 1..data.size) {
intersectionSet.retainAll(data[i])
}
return intersectionSet
}
Run Code Online (Sandbox Code Playgroud)
这会返回一个空列表,考虑到它试图与 Protein 对象相交并匹配每个标准作为一个整体,这是有道理的。
如何将 data[i].id 称为交叉条件?我对 Kotlin 和数据类相当陌生:)
我有这样一个数据框:
col0 col1 col2 col3
ID1 0 2 0 2
ID2 1 1 2 10
ID3 0 1 3 4
Run Code Online (Sandbox Code Playgroud)
我想删除包含零个以上的行。
我试着做:
cols = ['col1', etc]
df.loc[:, cols].value_counts()
Run Code Online (Sandbox Code Playgroud)
但这仅适用于系列,不适用于数据帧。
df.loc[:, cols].count(0) <= 1
Run Code Online (Sandbox Code Playgroud)
仅返回布尔值。
我觉得我已经接近第二次尝试了。
这是我的数据框列表:
[[1]]
ID Value
A 1
B 1
C 1
[[2]]
ID Value
A 1
D 1
E 1
[[3]]
ID Value
B 1
C 1
Run Code Online (Sandbox Code Playgroud)
我在左侧列中具有唯一(非冗余)ID的单个数据帧之后,在列中复制,并将NULL值设置为0:
ID [1]Value [2]Value [3]Value
A 1 1 0
B 1 0 1
C 1 0 1
D 0 1 0
E 0 1 0
Run Code Online (Sandbox Code Playgroud)
我试过了:
Reduce(function(x, y) merge(x, y, by=ID), datahere)
这提供了单个列表,但不考虑原始值的来源,并且在新行中重复重复的ID.
rbindlist(datahere, use.names=TRUE, fill=TRUE, idcol="Replicate")
Run Code Online (Sandbox Code Playgroud)
这提供了一个单独的列表,其中[x]值编号作为一个名为Replicate的新列,但它仍然不在我想要的结构中,因为ID列有冗余.