Commit 97e1ddfc authored by 张彦钊's avatar 张彦钊

add app list

parent a0f21c09
import pandas as pd
import pymysql
def con_sql(db,sql):
cursor = db.cursor()
try:
cursor.execute(sql)
result = cursor.fetchall()
df = pd.DataFrame(list(result))
except Exception:
print("发生异常", Exception)
df = pd.DataFrame()
finally:
db.close()
return df
def sort_app():
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"
df = con_sql(db, sql)
df[1]=df[1].apply(lambda x:set([i["appName"] for i in x]))
dianshang = {"美团","京东","淘宝"}
df[2] = df[1].apply(lambda x:1 if len(x&dianshang)>0 else 0)
print(df[2].unique())
if __name__ == "__main__":
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