I am using these dataset " dataset tempat perlancongan Malaysia.csv". In that I'm Passing the latitude and longitude for plotting the plot plot for spatial coordinate vs numerical feature.
error I got =
Value Error: Invalid property specified for object of type plotly.graph_objs.Choropleth: 'lat'
lat
and the data I have found provided latitude and longitude your data supports a scatter not a choroplethimport requests, io
import plotly.express as px
# https://www.data.gov.my/data/en_US/dataset/lokasi-tempat-pelancongan-mengikut-daerah-di-negeri-selangor/resource/18b5c1e0-e362-41a2-935c-c35795df9d17
df = pd.read_csv(
io.StringIO(
requests.get(
"https://www.data.gov.my/data/en_US/datastore/dump/18b5c1e0-e362-41a2-935c-c35795df9d17"
).text
)
)
px.scatter_geo(df, lat="LATITUDE", lon="LONGITUDE", hover_data=["NAMA"]).update_layout(
geo_scope="asia", geo_fitbounds="locations"
)
px.scatter_mapbox(
df,
lat="LATITUDE",
lon="LONGITUDE",
hover_data=["NAMA"],
mapbox_style="carto-positron",
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.