Spaces:
Sleeping
Sleeping
File size: 1,321 Bytes
6f00d18 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import streamlit as st
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
############### PAGE SETUP ########################
###################################################
st.set_page_config(layout="wide")
st.header("Smiple Charts")
############ HELPER FUNCTIONS #####################
###################################################
@st.cache_data
def load_data():
df = pd.read_csv('data/ny-vs-sf-houses.csv')
return df
################# PAGE LAYOUT #####################
###################################################
# Load the data
df = load_data()
# Display the data
display_df = df.sample(n=5)
st.dataframe(display_df)
# do a scatter chart
st.scatter_chart(df, x='price', y='elevation', color='city', size='sqft')
col1, col2, col3 = st.columns(3)
with col1:
# Make and new histo and display it
fig, ax = plt.subplots(figsize = (13,8))
_ = sns.histplot(df, x='elevation', hue='city', multiple='stack')
st.pyplot(fig)
st.markdown('---')
st.header('Weather Data')
weather_df = pd.read_csv('data/seattle-weather.csv')
weather_df_display = weather_df.sample(n=5)
st.dataframe(weather_df_display)
st.bar_chart(weather_df, y='weather')
st.dataframe(weather_df.value_counts('weather'))
st.bar_chart(weather_df, y='temp_max')
|