dao.py 544 B

1234567891011121314151617181920
  1. from dao import Mysql
  2. def load_order_data_from_mysql(city_uuid):
  3. """从数据库中读取数据"""
  4. client = Mysql()
  5. tablename = "tads_brandcul_cust_order"
  6. query_text = "*"
  7. df = client.load_data(tablename, query_text, city_uuid)
  8. if len(df) == 0:
  9. return None
  10. df.drop('stat_month', axis=1, inplace=True)
  11. df.drop('city_uuid', axis=1, inplace=True)
  12. print(df.columns)
  13. # 去除重复值和填补缺失值
  14. df.drop_duplicates(inplace=True)
  15. df.fillna(0, inplace=True)
  16. return df