Spaces:
Sleeping
Sleeping
File size: 1,207 Bytes
9ea509f |
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 |
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) |