Commit be0e6bfd authored by 张彦钊's avatar 张彦钊

add print

parent 3324cdaa
......@@ -114,10 +114,10 @@ class multiFFMFormatPandas:
x = 0
while True:
if x + step < data.__len__():
data_list.append(data.loc[x:x + step])
x = x + step + 1
data_list.append(data.iloc[x:x + step])
x = x + step
else:
data_list.append(data.loc[x:data.__len__()])
data_list.append(data.iloc[x:data.__len__()])
break
return data_list
......
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 exp():
db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_test')
sql = "select manufacturer,channel from user_feature"
df = con_sql(db, sql)
print("manufacturer unique")
print(len(df[0].unique()))
\ No newline at end of file
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