From 67e86ac5a978a372e2da1ead6246ac9cdf161fdd Mon Sep 17 00:00:00 2001 From: "houhan@gmail.com" Date: Thu, 22 Aug 2024 00:00:21 +0000 Subject: [PATCH] hotfix: add warning message if regex is incorrect --- code/Home.py | 2 +- code/util/streamlit.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code/Home.py b/code/Home.py index cd7bbc2..a7fcca4 100644 --- a/code/Home.py +++ b/code/Home.py @@ -12,7 +12,7 @@ """ -__ver__ = 'v2.5.0' +__ver__ = 'v2.5.1' import pandas as pd import streamlit as st diff --git a/code/util/streamlit.py b/code/util/streamlit.py index 7988287..2656cfc 100644 --- a/code/util/streamlit.py +++ b/code/util/streamlit.py @@ -395,7 +395,10 @@ def filter_dataframe(df: pd.DataFrame, ) if user_text_input: - df = df[df[column].astype(str).str.contains(user_text_input)] + try: + df = df[df[column].astype(str).str.contains(user_text_input, regex=True)] + except: + st.warning('Wrong regular expression!') return df