| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- from dao import Mysql
- def load_order_data_from_mysql(city_uuid):
- """从数据库中读取订单数据"""
- client = Mysql()
- tablename = "yunfu_mock_data"
- query_text = "*"
-
- # df = client.load_data(tablename, query_text, "city_uuid", city_uuid)
- df = client.load_mock_data(tablename, query_text)
- if len(df) == 0:
- return None
-
- # df.drop('stat_month', axis=1, inplace=True)
- # df.drop('city_uuid', axis=1, inplace=True)
-
- # 去除重复值和填补缺失值
- df.drop_duplicates(inplace=True)
- df.fillna(0, inplace=True)
- return df
- def load_cust_data_from_mysql(city_uuid):
- """从数据库中读取商户信息数据"""
- client = Mysql()
- tablename = "tads_brandcul_cust_info"
- query_text = "*"
-
- df = client.load_data(tablename, query_text, "BA_CITY_ORG_CODE", city_uuid)
- if len(df) == 0:
- return None
-
- return df
- def load_product_data_from_mysql(city_uuid):
- """从数据库中读取商品信息"""
- client = Mysql()
- tablename = "tads_brandcul_product_info"
- query_text = "*"
-
- df = client.load_data(tablename, query_text, "city_uuid", city_uuid)
- if len(df) == 0:
- return None
-
- return df
- if __name__ == '__main__':
- data = load_order_data_from_mysql("00000000000000000000000011445301")
- print(data)
|