mahedi420 commited on
Commit
5aea7f0
·
verified ·
1 Parent(s): 5580b46

update app for null

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -72,6 +72,8 @@ st.header("Data analysis by Chatbot")
72
 
73
  uploaded_file = st.file_uploader("Upload a CSV file", type=["csv"], key="uploaded_file")
74
 
 
 
75
  if uploaded_file is not None:
76
  # Display the uploaded file
77
  # st.write("Uploaded CSV file:", uploaded_file.name)
@@ -86,6 +88,8 @@ if uploaded_file is not None:
86
  # Convert each object-type column to a Python list
87
  lists_of_columns = [df[column].tolist() for column in object_columns.columns]
88
  string_of_csv = [element for sublist in lists_of_columns for element in sublist]
 
 
89
 
90
 
91
  df = df.applymap(lambda x: x.lower() if isinstance(x, str) else x)
@@ -96,10 +100,11 @@ if uploaded_file is not None:
96
  # df.columns = df.columns.map(lambda x: re.sub(pattern, '', x))
97
  df.columns = df.columns.astype(str)
98
  df.columns = df.columns.str.strip()
 
99
 
100
  question = st.text_input("Ask your Question :", key="user_input")
101
  # Display suggestions dynamically
102
- suggestions = suggest_words(question.strip(), string_of_csv)
103
  st.subheader("Suggestions:")
104
  if suggestions:
105
  for suggestion in suggestions:
 
72
 
73
  uploaded_file = st.file_uploader("Upload a CSV file", type=["csv"], key="uploaded_file")
74
 
75
+ string_list =[]
76
+
77
  if uploaded_file is not None:
78
  # Display the uploaded file
79
  # st.write("Uploaded CSV file:", uploaded_file.name)
 
88
  # Convert each object-type column to a Python list
89
  lists_of_columns = [df[column].tolist() for column in object_columns.columns]
90
  string_of_csv = [element for sublist in lists_of_columns for element in sublist]
91
+ for element in string_of_csv:
92
+ string_list.append(str(element))
93
 
94
 
95
  df = df.applymap(lambda x: x.lower() if isinstance(x, str) else x)
 
100
  # df.columns = df.columns.map(lambda x: re.sub(pattern, '', x))
101
  df.columns = df.columns.astype(str)
102
  df.columns = df.columns.str.strip()
103
+
104
 
105
  question = st.text_input("Ask your Question :", key="user_input")
106
  # Display suggestions dynamically
107
+ suggestions = suggest_words(question.strip(), string_list)
108
  st.subheader("Suggestions:")
109
  if suggestions:
110
  for suggestion in suggestions: