Commit 379debf6 authored by 张彦钊's avatar 张彦钊

add app list

parent 97e1ddfc
...@@ -16,12 +16,14 @@ def con_sql(db,sql): ...@@ -16,12 +16,14 @@ def con_sql(db,sql):
def sort_app(): def sort_app():
db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_prod') db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_prod')
sql = "select device_id,app_list from device_id_applist limit 60" sql = "select device_id,app_list from device_id_applist limit 6"
df = con_sql(db, sql) df = con_sql(db, sql)
df[1]=df[1].apply(lambda x:set([i["appName"] for i in x])) a = df[1].values.tolist()
dianshang = {"美团","京东","淘宝"} print(type(a[0]))
df[2] = df[1].apply(lambda x:1 if len(x&dianshang)>0 else 0) # df[1]=df[1].apply(lambda x:set([i["appName"] for i in x]))
print(df[2].unique()) # dianshang = {"美团","京东","淘宝"}
# df[2] = df[1].apply(lambda x:1 if len(x&dianshang)>0 else 0)
# print(df[2].unique())
if __name__ == "__main__": if __name__ == "__main__":
sort_app() sort_app()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment