Mattral commited on
Commit
f76903a
·
verified ·
1 Parent(s): 97edeae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -15
app.py CHANGED
@@ -480,7 +480,8 @@ df.drop(columns={col_to_delete}, inplace=True)
480
  ax.set_title('Feature Importance')
481
  st.pyplot(fig)
482
  new_line()
483
-
 
484
  if st.checkbox("Identify Outliers", value=False):
485
  numeric_cols = df.select_dtypes(include=np.number).columns.tolist()
486
  col_for_outliers = st.selectbox("Select Column to Check Outliers", options=numeric_cols)
@@ -490,12 +491,7 @@ df.drop(columns={col_to_delete}, inplace=True)
490
  st.pyplot(fig)
491
  new_line()
492
 
493
- if st.checkbox("Show Pairwise Scatter Plots", value=False):
494
- selected_cols = st.multiselect("Select Columns", options=df.columns, default=df.columns[:2])
495
- sns.pairplot(df[selected_cols])
496
- st.pyplot()
497
- new_line()
498
-
499
  if st.checkbox("Show Cross-tabulations", value=False):
500
  categorical_cols = df.select_dtypes(include=['object', 'category']).columns.tolist()
501
  x_col = st.selectbox("Select X-axis Column for Cross-tab", options=categorical_cols, index=0)
@@ -504,6 +500,7 @@ df.drop(columns={col_to_delete}, inplace=True)
504
  st.write(cross_tab)
505
  new_line()
506
 
 
507
  if st.checkbox("Segmented Analysis", value=False):
508
  segments = st.selectbox("Select Segment", options=df.columns)
509
  segment_values = df[segments].dropna().unique()
@@ -512,15 +509,25 @@ df.drop(columns={col_to_delete}, inplace=True)
512
  st.write(segmented_data)
513
  new_line()
514
 
515
- # Assuming 'date_column' is the name of your datetime column
516
  if st.checkbox("Temporal Analysis", value=False):
517
- fig, ax = plt.subplots()
518
- df.set_index('date_column')['some_value'].plot(ax=ax)
519
- ax.set_title('Trend Over Time')
520
- st.pyplot(fig)
521
- new_line()
 
 
 
 
 
 
 
 
 
 
522
 
523
-
524
  if st.checkbox("Show Word Cloud", value=False):
525
  text_col = st.selectbox("Select Text Column for Word Cloud", options=df.select_dtypes(include=[np.object]).columns.tolist())
526
  text_data = ' '.join(df[text_col].dropna())
@@ -531,6 +538,7 @@ df.drop(columns={col_to_delete}, inplace=True)
531
  st.pyplot(fig)
532
  new_line()
533
 
 
534
  if st.checkbox("Show Text Statistics", value=False):
535
  text_col = st.selectbox("Select Text Column for Statistics", options=df.select_dtypes(include=[np.object]).columns.tolist())
536
  text_stats = df[text_col].dropna().apply(lambda x: {'length': len(x), 'word_count': len(x.split())})
@@ -539,7 +547,7 @@ df.drop(columns={col_to_delete}, inplace=True)
539
  new_line()
540
 
541
 
542
-
543
  # Interactive Data Tables
544
  interactive_table = st.checkbox("Show Interactive Data Table", value=False)
545
  new_line()
 
480
  ax.set_title('Feature Importance')
481
  st.pyplot(fig)
482
  new_line()
483
+
484
+ new_line()
485
  if st.checkbox("Identify Outliers", value=False):
486
  numeric_cols = df.select_dtypes(include=np.number).columns.tolist()
487
  col_for_outliers = st.selectbox("Select Column to Check Outliers", options=numeric_cols)
 
491
  st.pyplot(fig)
492
  new_line()
493
 
494
+ new_line()
 
 
 
 
 
495
  if st.checkbox("Show Cross-tabulations", value=False):
496
  categorical_cols = df.select_dtypes(include=['object', 'category']).columns.tolist()
497
  x_col = st.selectbox("Select X-axis Column for Cross-tab", options=categorical_cols, index=0)
 
500
  st.write(cross_tab)
501
  new_line()
502
 
503
+ new_line()
504
  if st.checkbox("Segmented Analysis", value=False):
505
  segments = st.selectbox("Select Segment", options=df.columns)
506
  segment_values = df[segments].dropna().unique()
 
509
  st.write(segmented_data)
510
  new_line()
511
 
512
+ new_line()
513
  if st.checkbox("Temporal Analysis", value=False):
514
+ date_col_options = df.select_dtypes(include=[np.datetime64]).columns.tolist()
515
+ value_col_options = df.select_dtypes(include=np.number).columns.tolist()
516
+
517
+ if not date_col_options:
518
+ st.error("No datetime columns found in the DataFrame.")
519
+ elif not value_col_options:
520
+ st.error("No numeric columns found in the DataFrame.")
521
+ else:
522
+ date_col = st.selectbox("Select Date Column", options=date_col_options)
523
+ value_col = st.selectbox("Select Value Column", options=value_col_options)
524
+
525
+ fig, ax = plt.subplots()
526
+ df.set_index(date_col)[value_col].plot(ax=ax)
527
+ ax.set_title(f'Trend Over Time - {value_col}')
528
+ st.pyplot(fig)
529
 
530
+ new_line()
531
  if st.checkbox("Show Word Cloud", value=False):
532
  text_col = st.selectbox("Select Text Column for Word Cloud", options=df.select_dtypes(include=[np.object]).columns.tolist())
533
  text_data = ' '.join(df[text_col].dropna())
 
538
  st.pyplot(fig)
539
  new_line()
540
 
541
+ new_line()
542
  if st.checkbox("Show Text Statistics", value=False):
543
  text_col = st.selectbox("Select Text Column for Statistics", options=df.select_dtypes(include=[np.object]).columns.tolist())
544
  text_stats = df[text_col].dropna().apply(lambda x: {'length': len(x), 'word_count': len(x.split())})
 
547
  new_line()
548
 
549
 
550
+ new_line()
551
  # Interactive Data Tables
552
  interactive_table = st.checkbox("Show Interactive Data Table", value=False)
553
  new_line()