小编Wil*_*man的帖子

如何在 ggplot2 中使用 geom_sf 获得多边形边界

之前在旧线程中已经问过这个问题,但是接受的答案目前在 ggplot2 的当前版本中不再有效。这是一个最小的例子:

library(ggplot2)
library(rnaturalearth)
world = ne_countries(scale = "medium", returnclass = "sf")
ggplot(world) + 
  geom_sf(aes(fill = pop_est)) + 
  scale_fill_viridis_c(option = "plasma", trans = "sqrt")
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

我的问题是:我怎样才能摆脱每个国家的边界​​?

r ggplot2 r-sf

9
推荐指数
1
解决办法
1499
查看次数

将 Julia 数据框转换为 Python Pandas 数据框

我正在尝试将 PyCall.jlwrap ('Julia') 对象转换为 Pandas 数据帧。我正在使用 PyJulia 在 Julia 中运行优化算法,结果会输出一个数据帧对象。我想将该对象转换为 Pandas 数据框。

这是一个与 5 年前在这里提出的类似问题。但是,没有任何代码建议如何完成传输。

任何帮助都会有用!

这是我目前设置的代码。知道在我的“optimization_program”的背景中发生了什么并不是很有用,而只是知道“run_hybrid”和“run_storage”命令返回的内容返回了一个数据帧:

### load in necessary modules for pyjulia    
from julia import Main as jl 

##load my user defined module
jl.include("optimization_program_v3.jl")

##run function from module
results = jl.run_hybrid(generic_inputs)

##test type of item returned
jl.typeof(results)
returns: <PyCall.jlwrap DataFrame>

##try to convert to pandas
test = pd.DataFrame(results)
Run Code Online (Sandbox Code Playgroud)

值错误回溯(最近一次调用)

在 ()

----> 1 测试 = pd.DataFrame(结果)

init (self, data, index, columns, dtype, copy)

第 420 …

python dataframe pandas julia

4
推荐指数
1
解决办法
731
查看次数

标签 统计

dataframe ×1

ggplot2 ×1

julia ×1

pandas ×1

python ×1

r ×1

r-sf ×1