Mpavan45 commited on
Commit
9a7d598
·
verified ·
1 Parent(s): 2236f57

Update pages/2_Data Cleaning and Processing .py

Browse files
pages/2_Data Cleaning and Processing .py CHANGED
@@ -56,13 +56,14 @@ if df is not None:
56
 
57
  # Cleaning the 'Location' column
58
  st.subheader("Cleaning the 'Location' Column:")
59
- df['Location'] = df['Location'].apply(lambda x: re.findall(r'\w+', x))
60
  df['Location'] = df['Location'].apply(lambda x: ' '.join(x))
61
  df['Location'] = df['Location'].apply(lambda x: re.sub(r"\d+", r",\g<0>", x))
62
-
63
  st.write("Cleaned 'Location' Column:")
64
  st.write(df[['Location']].head())
65
 
 
66
  # Cleaning the 'Discount' column
67
  st.subheader("Cleaning the 'Discount' Column:")
68
  def f(x):
 
56
 
57
  # Cleaning the 'Location' column
58
  st.subheader("Cleaning the 'Location' Column:")
59
+ df['Location'] = df['Location'].apply(lambda x: re.findall(r'\w+', str(x)) if isinstance(x, str) else [])
60
  df['Location'] = df['Location'].apply(lambda x: ' '.join(x))
61
  df['Location'] = df['Location'].apply(lambda x: re.sub(r"\d+", r",\g<0>", x))
62
+
63
  st.write("Cleaned 'Location' Column:")
64
  st.write(df[['Location']].head())
65
 
66
+
67
  # Cleaning the 'Discount' column
68
  st.subheader("Cleaning the 'Discount' Column:")
69
  def f(x):