tb_data_extract.py 911 B

12345678910111213141516171819202122232425
  1. import pandas as pd
  2. from pprint import pprint
  3. from Words.Phrase_dict import en_dict_with_err_or_true_mean
  4. path = r"G:\zwj\WL\en2cn\more_files\英译汉词汇非常见释义表.xlsx"
  5. # df = pd.read_excel(path, sheet_name="批改错误词汇释义整理")
  6. df = pd.read_excel(path, sheet_name="5-31")
  7. # print(df.shape)
  8. df = df.where(df.notnull(), "")
  9. words = {}
  10. for k, row in df.iterrows():
  11. res = {
  12. "err_mean": row["错误释义"] if row["错误释义"] else "",
  13. "true_mean": row["正确释义"] if row["正确释义"] else "",
  14. }
  15. if row["英语词汇"].strip() not in en_dict_with_err_or_true_mean:
  16. words[row["英语词汇"].strip()] = res
  17. elif en_dict_with_err_or_true_mean[row["英语词汇"].strip()] != res:
  18. print(row["英语词汇"].strip())
  19. print(res)
  20. print('=================================================')
  21. pprint(words)