spider.py 529 B

1234567891011121314151617181920212223242526
  1. """
  2. @author: luojunhui
  3. """
  4. import pandas as pd
  5. from tqdm import tqdm
  6. from applications import PQMySQL
  7. db = PQMySQL()
  8. file = pd.read_excel("mean_cache.xlsx")
  9. data_list = file.values.tolist()
  10. for line in tqdm(data_list):
  11. account_name = line[0]
  12. index = line[1]
  13. avg_read = line[2]
  14. sql = f"""
  15. UPDATE long_articles_accounts
  16. SET account_position_read_avg = %s
  17. where account_name = %s and account_position = %s;
  18. """
  19. db.update(sql, params=(avg_read, account_name, index))
  20. print("successful")