I am a beginner and trying to visualize some data with Pydeck. My problem is, it only shows the background map and no data. I would like to visualize the prices of the Air BnBs in Berlin.
Maybe someone can help? Thanks!
The data is retrieved from: https://www.kaggle.com/code/lennarthaupts/airbnb-prices-in-berlin/data
import streamlit as st
import pydeck as pdk
st.title("Air BnB Berlin 07/2021")
#data
in_csv = "listings_berlin.csv"
#layer
layer1 = pdk.Layer(
'ColumnLayer',
in_csv,
get_position=['longitude', 'latitude'],
auto_highlight=True,
elevation_scale=50,
pickable=True,
elevation_range=[0, 3000],
extruded=True,
coverage=1)
# Set viewport location to Berlin
view_state = pdk.ViewState(
longitude=13.4,
latitude=52.5,
zoom=6,
min_zoom=5,
max_zoom=15,
pitch=40.5,
bearing=-27.36)
# render
air = pdk.Deck(layers=[layer1], initial_view_state=view_state)
air
Thanks!
About the data:
For some reason the download link on the Kaggle website was unresponsive.
I looked for the data and found it on the inside AirBNB website.
Looks like there are some NaNs which causes the script to fail.
I created a new
csv
file with just part of the coordinates to test my code.This is the map with some of the listings in red.