utilisation de is_numeric_dtype au lieu de verifier par type
This commit is contained in:
@@ -2,6 +2,7 @@ import pandas as pd
|
||||
import streamlit as st
|
||||
import matplotlib.pyplot as plt
|
||||
import seaborn as sns
|
||||
from pandas.api.types import is_numeric_dtype
|
||||
|
||||
st.title("Project Miner")
|
||||
|
||||
@@ -49,9 +50,10 @@ if uploaded_file:
|
||||
st.pyplot(fig)
|
||||
|
||||
st.subheader("Boxplot")
|
||||
column_to_plot_box = st.selectbox("Select Column for Boxplot", data.columns, key="boxplot")
|
||||
if column_to_plot_box:
|
||||
dataNumeric = data.select_dtypes(include='number')
|
||||
column_to_plot = st.selectbox("Select Column for Boxplot", dataNumeric.columns)
|
||||
if column_to_plot:
|
||||
fig, ax = plt.subplots()
|
||||
sns.boxplot(y=data[column_to_plot_box].dropna(), ax=ax)
|
||||
ax.set_title(f'Boxplot of {column_to_plot_box}')
|
||||
st.pyplot(fig)
|
||||
sns.boxplot(data=data, x=column_to_plot, ax=ax)
|
||||
ax.set_title(f'Boxplot of {column_to_plot}')
|
||||
st.pyplot(fig)
|
Reference in New Issue
Block a user