我正在制作交互式地图,地图本身没有问题,元素位于附加悬停标记中的方式有问题。有什么办法可以改变这个顺序吗?是否可以不显示纬度和经度指示器?
示例代码:
@st.cache(hash_funcs={dict: lambda _: None})
def my_stat_map(df_region_map):
fig_map = px.scatter_mapbox(df_region_map,
hover_name='Region name',
hover_data=['Confirmed', 'Deaths', 'Recovered',
'Daily confirmed', 'Daily deaths', 'Daily recovered'],
lat='Latitude dd',
lon='Longitude dd',
size='Confirmed',
color='Confirmed',
color_continuous_scale='Sunsetdark',
zoom=3,
size_max=45,
opacity=0.8,
height=600)
fig_map.update_layout(mapbox_style="carto-positron", showlegend=True)
fig_map.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0})
dict_map = {'map_key': fig_map}
return dict_map
Run Code Online (Sandbox Code Playgroud)
如何更改此输出中的顺序?我想删除纬度和经度,或者至少将它们移到输出的末尾。
let's say we have the following code example where we create two basic dataframes:
import pandas as pd
# Creating Dataframes
a = [{'Name': 'abc', 'Age': 8, 'Grade': 3},
{'Name': 'xyz', 'Age': 9, 'Grade': 3}]
df1 = pd.DataFrame(a)
b = [{'ID': 1,'Name': 'abc', 'Age': 8},
{'ID': 2,'Name': 'xyz', 'Age': 9}]
df2 = pd.DataFrame(b)
# Printing Dataframes
display(df1)
display(df2)
Run Code Online (Sandbox Code Playgroud)
We get the following datasets:
Name Age Grade
0 abc 8 3
1 xyz 9 3
ID Name Age
0 1 abc …Run Code Online (Sandbox Code Playgroud) 我有一个部署到 Heroku 的 Web 应用程序。在应用程序的地址行中,显示正在运行的文件的名称和 Streamlit 的名称。我怎样才能用整数改变这一行。也许您需要添加某种配置文件?
我需要更改“dashboard.Strealit”行
此外,我遇到了一个事实:我没有应用程序主题设置。我怎样才能启用它们?
还有一个关于配置文件的问题。它们位于路径:/.streamlit/,但如果我将代码放在 GitHUB 上,那么这些文件应该位于哪里,特别是文件 config.toml?
我刚刚开始了解 R 语言,之前使用过 python。挑战是用 * 替换字符串中每个单词的最后一个字符。
它应该是什么样子:example text in string,结果工作:exampl* tex* i* strin*
我的代码:
library(tidyverse)
library(stringr)
string_example = readline("Enter our text:")
string_example = unlist(strsplit(string_example, ' '))
string_example
result = str_replace(string_example, pattern = "*\b", replacement = "*")
result
Run Code Online (Sandbox Code Playgroud)
我收到错误:
> result = str_replace(string_example, pattern = "*\b", replacement = "*")
Error in stri_replace_first_regex(string, pattern, fix_replacement(replacement), :
Syntax error in regex pattern. (U_REGEX_RULE_SYNTAX, context=``)
Run Code Online (Sandbox Code Playgroud)
帮助解决任务
哦,我注意到一个错误,模式应该是.\b。这就是代码的执行方式,但是字符串中没有替换