我正在尝试执行以下代码 -
library(dplyr) ; library(rgdal) ; library(leaflet);
crimes <- read.csv("crime_data.csv", header = T) %>%
filter(borough == "Manchester",
date == "2015-11-01") %>%
group_by(category, lsoa, borough) %>%
summarise(n = n()) %>%
rename(LSOA11CD = lsoa) %>%
as.data.frame()
lsoa <- readOGR("manchester_lsoa.geojson", "OGRGeoJSON")
ui <- shinyUI(fluidPage(
fluidRow(
column(7, offset = 1,
br(),
div(h4(textOutput("title"), align = "center"), style = "color:black"),
div(h5(textOutput("period"), align = "center"), style = "color:black"),
br())),
fluidRow(
column(7, offset = 1,
leafletOutput("map", height="530"),
br(),
actionButton("reset_button", "Reset view")),
column(3,
uiOutput("category", align = "left")))
))
server …Run Code Online (Sandbox Code Playgroud) 我有两个 Python 字典 -
dict1 = {'a' : [1, 2, 3], 'b' : [4, 5, 6], 'c' : [7, 8, 9]}
dict2 = {'a' : 30, 'b' : 75, 'c' : 15}
Run Code Online (Sandbox Code Playgroud)
我想dict1根据 的值进行排序dict2。最终的答案应该是这样的——
[['c', [7, 8, 9]], ['a', [1, 2, 3]], ['b', [4, 5, 6]]]
Run Code Online (Sandbox Code Playgroud)
解决这个问题最有效的方法是什么?