Map error-NY motor vehicle collision

Hi everyone!

I am learning streamlit using a course from Snehan Kekre (best teacher). The course develops a dashboard with vehicle collisions in NY but I have a problem when I use the st.map function in the line st.map(data.query(“injured_persons >= @injured_people”)[[“latitude”, “longitude”]].dropna(how=“any”), the new version of the data does not have the column “injured_persons” but it does “number of persons injured". When I replace it, it does not work. This is the code

st.title(“Motor Vehicle Collisions in New York City”)
st.markdown("This application is a Streamlit dashboard that can be "
“to analyze motor vehicle collisions in NYC”)

@st.cache(persist=True)
def load_data(nrows):
data = pd.read_csv(DATA_URL, nrows=nrows, parse_dates=[[‘CRASH DATE’,‘CRASH TIME’]])
data.dropna(subset=[‘LATITUDE’,‘LONGITUDE’], inplace=True)
lowercase = lambda x: str(x).lower()
data.rename(lowercase, axis=‘columns’, inplace=True)
data.rename(columns={‘crash date_crash time’:‘Date/Time’}, inplace=True)
return data

data=load_data(100000)

st.header(“Where are the most people injured in NYC?”)
injured_people = st.slider(“Number of persons injured in vehicle collisions”, 1 , 19)
st.map(data.query(“number of persons injured >= @injured_people”)[[“latitude”, “longitude”]].dropna(how=“any”))

if st.checkbox(“Show Raw Data”, False):
st.subheader(‘Raw Data’)
st.write(data)

Thanks for the help

Hi everyone,

I fixed it, take a look:

st.map(data.query(‘number of persons injured >= @injured_people’)[[“latitude”, “longitude”]].dropna(how=“any”))

Thanks,

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.