2021-04-27
閱讀量:
969
字節(jié)跳動數(shù)據(jù)運營測試題
問題(例):近三月每月各組有多少活躍客戶,請以圖和表的形式展現(xiàn),并提出團(tuán)隊可能存在的問題。
參考python代碼
data=pd.read_excel(r"C:\Users\Administrator\Desktop\字節(jié)跳動數(shù)據(jù)運營測試題(1).xlsx",sheet_name="數(shù)據(jù)")
data["年月"]=data["日"].map(lambda x:(x.year,x.month))
data["組別"]=data["部門ID"].map(lambda x:x[:2])
data1=data[data["日消費"]>0]
def distinct_count2(x):
print(x)
y=x.unique()
#這里的x是一個序列
return y.shape[0]
pivot1=data1.pivot_table(index=["年月","組別"],values=["客戶id"],aggfunc={"客戶id":distinct_count2})
pivot1.unstack(level=-1)
excel文件下載鏈接
鏈接:https://pan.baidu.com/s/1VdboQa64ABDVSADtzlN_hw
提取碼:7ijz
復(fù)制這段內(nèi)容后打開百度網(wǎng)盤手機(jī)App,操作更方便哦






評論(0)


暫無數(shù)據(jù)
推薦帖子
0條評論
0條評論
0條評論
0條評論