deutsch values

This commit is contained in:
shoney 2023-06-25 16:02:54 +00:00
parent 9b00bafaa0
commit 68d488d43b
2 changed files with 14 additions and 3 deletions

View file

@ -15,8 +15,14 @@ class DataFrame:
self.df_eng["category"] = self.df_eng["category"].str.lower().apply(lambda c:self.normalize(c)) self.df_eng["category"] = self.df_eng["category"].str.lower().apply(lambda c:self.normalize(c))
self.df_de["name"] = self.df_de["name"].str.lower().apply(lambda n:self.normalize(n))
self.df_de["category"] = self.df_de["category"].str.lower().apply(lambda c:self.normalize(c))
self.df_eng=self.df_eng.drop_duplicates() self.df_eng=self.df_eng.drop_duplicates()
self.df_de=self.df_de.drop_duplicates()
def normalize(self,doc): def normalize(self,doc):
# Remove html tags # Remove html tags
@ -33,6 +39,7 @@ class DataFrame:
def create(self): def create(self):
self.df_eng = pd.DataFrame(columns=['name','category']) self.df_eng = pd.DataFrame(columns=['name','category'])
self.df_de = pd.DataFrame(columns=['name','category'])
resp=self.es.getFeatures() resp=self.es.getFeatures()
for hit in resp['hits']['hits']: for hit in resp['hits']['hits']:
@ -56,10 +63,14 @@ class DataFrame:
if(list_row_en["name"]!=None and list_row_en["category"]!=None): if(list_row_en["name"]!=None and list_row_en["category"]!=None):
new_row = pd.Series(list_row_en) new_row = pd.Series(list_row_en)
self.df_eng=pd.concat([self.df_eng, new_row.to_frame().T], ignore_index=True) self.df_eng=pd.concat([self.df_eng, new_row.to_frame().T], ignore_index=True)
if(list_row_de["name"]!=None and list_row_de["category"]!=None):
new_row = pd.Series(list_row_de)
self.df_de=pd.concat([self.df_de, new_row.to_frame().T], ignore_index=True)
# df_eng.loc[len(df_eng)] = list_row # df_eng.loc[len(df_eng)] = list_row
self.clean() self.clean()
return self.df_eng return [self.df_eng,self.df_de]

View file

@ -9,9 +9,9 @@ def main():
df=DataFrame(es) df=DataFrame(es)
df_eng=df.create() [df_eng, df_de]=df.create()
print(df_eng.head()) print(df_de.head(2).to_latex())
# df_eng["category"].astype("category") # df_eng["category"].astype("category")