rwcuffney's picture
Create app.py
9ea509f
raw
history blame
No virus
1.21 kB
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
x = st.slider('Select a value')
st.write(x, 'squared is', x * x)
df = pd.read_csv('playing_cards/cards.csv').sort_values('class index')
df_test = df[df['data set']=='test']
df_train = df[df['data set']=='train']
df_validate = df[df['data set']=='validate']
### HORIZONTAL BAR ###
# Get the value counts of the 'labels' column
value_counts = df.groupby('labels')['class index'].count().iloc[::-1]
fig, ax = plt.subplots(figsize=(10,10))
# Create a bar chart of the value counts
ax = value_counts.plot.barh()
# Set the chart title and axis labels
ax.set_title('Value Counts of Labels')
ax.set_xlabel('Label')
ax.set_ylabel('Count')
# Show the chart
st.pyplot(fig)
### PIE CHART ###
# Get the value counts of the 'labels' column
value_counts = df.groupby('data set')['class index'].count().iloc[::-1]
value_counts =df['data set'].value_counts()
fig, ax = plt.subplots(figsize=(5,5)
)
# Create a bar chart of the value counts
ax = value_counts.plot.pie(autopct='%1.1f%%')
# Set the chart title and axis labels
ax.set_title('Train, Validate, Test Distribution')
# Show the chart
st.pyplot(fig)