Update app.py
Browse files
app.py
CHANGED
|
@@ -57,18 +57,28 @@ class DataList:
|
|
| 57 |
df = self.table
|
| 58 |
if search_query:
|
| 59 |
df = df[df.name_lowercase.str.contains(search_query.lower())]
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
| 62 |
return result
|
| 63 |
|
| 64 |
@staticmethod
|
| 65 |
-
def
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
@staticmethod
|
| 74 |
def to_html(df: pd.DataFrame, table_header: str) -> str:
|
|
|
|
| 57 |
df = self.table
|
| 58 |
if search_query:
|
| 59 |
df = df[df.name_lowercase.str.contains(search_query.lower())]
|
| 60 |
+
df1 = self.filter_table1(df, filter_names)
|
| 61 |
+
df2 = self.filter_table2(df1,filter_names2)
|
| 62 |
+
df3 = self.filter_table3(df2,filter_names3)
|
| 63 |
+
result = self.to_html(df3, self.table_header)
|
| 64 |
return result
|
| 65 |
|
| 66 |
@staticmethod
|
| 67 |
+
def filter_table1(df: pd.DataFrame, filter_names: list[str]) -> pd.DataFrame:
|
| 68 |
+
df = df.loc[df.Module.isin(set(filter_names))]
|
| 69 |
+
return df
|
| 70 |
+
|
| 71 |
+
@staticmethod
|
| 72 |
+
def filter_table2(df: pd.DataFrame,filter_names2: list[str]) -> pd.DataFrame:
|
| 73 |
+
df['Type'] = df['Type'].fillna("").astype(str);
|
| 74 |
+
df= df[df.Type.str.contains('|'.join(filter_names2),case=False, regex=True)]
|
| 75 |
+
return df
|
| 76 |
+
|
| 77 |
+
@staticmethod
|
| 78 |
+
def filter_table3(df: pd.DataFrame,filter_names3: list[str]) -> pd.DataFrame:
|
| 79 |
+
df['Hashtags'] = df['Hashtags'].fillna("").astype(str);
|
| 80 |
+
df= df[df.Hashtags.str.contains('|'.join(map(re.escape, filter_names3)),case=False, regex=True)]
|
| 81 |
+
return df
|
| 82 |
|
| 83 |
@staticmethod
|
| 84 |
def to_html(df: pd.DataFrame, table_header: str) -> str:
|