import numpy as np import pandas as pd import streamlit as st import warnings warnings.simplefilter(action='ignore', category=UserWarning) warnings.simplefilter(action='ignore', category=FutureWarning) import numpy as np import pandas as pd import streamlit as st import warnings warnings.simplefilter(action='ignore', category=UserWarning) warnings.simplefilter(action='ignore', category=FutureWarning) # Load datasets df1 = pd.read_csv('./data/ausprivauto0405.csv') df2 = pd.read_csv('./data/swmotorcycle.csv') st.title("Summary Statistics") # ---------------------- DATASET 1 ------------------------ st.header("Dataset 1: ausprivauto0405") if st.checkbox("Show raw data (Dataset 1)"): st.subheader("Raw Data") st.write(df1) if st.checkbox("Show summary statistics (Dataset 1)"): st.subheader('Categorical Variables') obj_cols = df1.select_dtypes(include='object') st.write(obj_cols.describe().T) st.subheader('Numerical Variables') num_cols = df1.select_dtypes(exclude='object') st.write(num_cols.describe().T) st.markdown(""" ## ausprivauto0405 is a data frame of 9 columns and 67,856 rows: -Exposure: The number of policy years. -VehValue: The vehicle value in thousand of AUD. -VehAge: The vehicle age group. -VehBody: The vehicle body group. -Gender: The gender of the policyholder. -DrivAge: The age of the policyholder. -ClaimOcc: Indicates occurence of a claim. -ClaimNb: The number of claims. -ClaimAmount: The sum of claim payments. """) # ---------------------- DATASET 2 ------------------------ st.header("Dataset 2: swmotorcycle") if st.checkbox("Show raw data (Dataset 2)"): st.subheader("Raw Data") st.write(df2) if st.checkbox("Show summary statistics (Dataset 2)"): st.subheader('Categorical Variables') obj_cols2 = df2.select_dtypes(include='object') st.write(obj_cols2.describe().T) st.subheader('Numerical Variables') num_cols2 = df2.select_dtypes(exclude='object') st.write(num_cols2.describe().T) st.markdown(""" ## swmotorcycle is a data frame of 9 columns and 64,548 rows: -OwnerAge: The owner age. -Gender: The gender. -Area: The type of area. -RiskClass: The motorcycle class, a classification by the so called EV ratio, defined as (Engine power in kW x 100) / (Vehicle weight in kg + 75), rounded to the nearest lower integer. The 75 kg represent the average driver weight. The EV ratios are divided into seven classes. -VehAge: The Vehicle age, between 0 and 99. -BonusClass: The bonusclass, taking values from 1 to 7. A new driver starts with bonus class 1; for each claim-free year the bonus class is increased by 1. After the first claim the bonus is decreased by 2; the driver can not return to class 7 with less than 6 consecutive claim free years. -Exposure: The number of policy years. -ClaimNb: The number of claims. -ClaimAmount: The sum of claim payments. """)