時間:2023-03-16 00:14:02 | 來源:電子商務(wù)
時間:2023-03-16 00:14:02 來源:電子商務(wù)
本次分析的是英國一家在線零售商的交易訂單數(shù)據(jù),時間跨越為:2010年12月1日至2011年12月1日。數(shù)據(jù)來源于UCI Maching Learning Repository 。數(shù)據(jù)量為50萬。grouped_month = df_order.groupby('Month')order_month_total_price = grouped_month.TotalPrice.sum()plt.figure(figsize=(10,6))plt.plot(order_month_total_price)plt.xlabel('month')plt.ylabel('price')plt.title('total price pre month')
可以看到隨著時間的推移,每月訂單總額在逐步提升,尤其在2011-08后有一個顯著的提升。但是同年11月份又出現(xiàn)了大幅下滑。order_month_customers = grouped_month.InvoiceNo.count()plt.figure(figsize=(10,6))plt.plot(order_month_customers)plt.xlabel('month')plt.ylabel('order')plt.title('number of orders pre month')
訂單數(shù)量的變化和消費金額大體一致。order_month_products = grouped_month.Quantity.sum()plt.figure(figsize=(10,6))plt.plot(order_month_products)plt.xlabel('month')plt.ylabel('products')plt.title('number of products pre month')
銷售商品數(shù)量的變化自然和前面兩項的變化是一致的。order_month_customers = grouped_month.CustomerID.apply(lambda x:len(x.drop_duplicates()))plt.figure(figsize=(10,6))plt.plot(order_month_customers)plt.xlabel('month')plt.ylabel('customers')plt.title('number of customers pre month')
消費客戶數(shù)隨著時間的發(fā)展和上面也是一樣的。但是可以更細致地看到,消費客戶數(shù)低于訂單數(shù),說明這個電商還是有一定的用戶黏性,即用戶復(fù)購率還不錯。# 查看有消費的記錄# 注意query只接受字符串形式的參數(shù)df_customer = df_order.groupby('CustomerID').agg({'InvoiceNo':'count', 'TotalPrice':'sum'}).query('TotalPrice > 0')df_customer.describe()
用戶平均購買商品的數(shù)量為5,最多的是購買了249件,即電商企業(yè)的大客戶。plt.figure(figsize=(10,6))plt.scatter(x=df_customer.InvoiceNo, y=df_customer.TotalPrice, alpha = 0.3)plt.xlabel('Times')plt.ylabel('Total Price')plt.title('Times and Total Price')
可以看到,存在少許的離群點。 可以利用切比雪夫定理,截取Total Price平均數(shù)2個標準差以內(nèi)的數(shù)據(jù)(這里左邊界用0即可)。plt.figure(figsize=(10,6))plt.scatter(x=df_customer.query('TotalPrice < 18456').InvoiceNo, y=df_customer.query('TotalPrice < 18456').TotalPrice, alpha = 0.3)plt.xlabel('Times')plt.ylabel('Total Price')plt.title('Times and Total Price')
這里可以看出二者具有一定的線性規(guī)律,大額多訂單客戶還是非常多的。plt.figure(figsize=(10,6))plt.hist(df_customer.query('TotalPrice < 18456').TotalPrice, bins = 30)plt.xlabel('Total Price')plt.ylabel('Frequence')plt.title('Total Price Distribution')
消費金額是典型的長尾分布,大部分客戶的消費金額小于2500英鎊。plt.figure(figsize=(10,6))user_amount.prop.plot()plt.xlabel('Total')plt.ylabel('Prop')plt.title('Customers Cumsum')
按用戶消費金額進行升序排列后繪圖。order_dif.describe()
用戶的平均消費間隔是33天,最長的消費間隔可達1年,其實就是用戶流失了。如果要喚回用戶的話,建議判斷的最長失活時長不超過33天。plt.figure(figsize=(10,6))plt.hist((order_dif / np.timedelta64(1, 'D')).dropna(), bins = 30)plt.xlabel('Period')plt.ylabel('Frequence')plt.title('Period Distribution')
又是非常典型的長尾分布,大部分用戶的消費間隔其實不長。order_date_min = df_order.groupby('CustomerID').InvoiceDate.min()order_date_max = df_order.groupby('CustomerID').InvoiceDate.max()order_date_dif = order_date_max - order_date_minorder_date_dif.head(10)
理論上來說,隨著產(chǎn)品的成熟,用戶生命周期是呈現(xiàn)增長的趨勢的,但是這個數(shù)據(jù)集并沒有體現(xiàn)用戶注冊時間這一類可以看出時間遠近的變量(第一次訂單時間是不可以的,因為這個數(shù)據(jù)集只是一年內(nèi)的數(shù)據(jù)。)因此不好判斷。order_date_dif.mean()
用戶的平均生命周期是133天,但是平均數(shù)就準確么?不一定的,還是需要查看整體分布。plt.figure(figsize=(10,6))plt.hist((order_date_dif / np.timedelta64(1,'D')).dropna(), bins = 90)plt.xlabel('Life Period')plt.ylabel('Frequence')plt.title('Life Period Distribution')
可以看到存在很多一次消費后就不再購買的客戶,這些都是屬于質(zhì)量較差的客戶。這可能是這部分引流的渠道客戶質(zhì)量不高。 plt.figure(figsize=(10,6))plt.hist((order_date_dif / np.timedelta64(1,'D')).dropna()[(order_date_dif / np.timedelta64(1,'D')).dropna()>0], bins = 90)plt.xlabel('Life Period')plt.ylabel('Frequence')plt.title('Life Period Distribution(more than 0 day)')
雖然排除了一次性消費客戶,但仍有不少用戶生命周期靠攏在0。(order_date_dif / np.timedelta64(1,'D')).dropna()[(order_date_dif / np.timedelta64(1,'D')).dropna()>0].mean()
二次消費或者以上的客戶的生命周期大約為191天,高于總體的133天。因此從運營策略上看來,用戶首次消費后應(yīng)該花費更多的精力,以引導(dǎo)其進行二次、多次消費。對于用戶的生命周期,這會帶來相較于原來1/2的增量。purchase_status_counts.fillna(0).T.plot.area(figsize = (10,6))
purchase_status_counts.fillna(0).T.apply(lambda x:x/x.sum(), axis=1)
可以看出用戶層級的分布和用戶轉(zhuǎn)化漏斗趨勢。隨著產(chǎn)品的發(fā)展,活躍用戶的占比為10%-15%,新增用戶沒有產(chǎn)品剛剛推出的時候流量大,這是正常的,因為產(chǎn)品推出期間一定采取了大量的引流措施?;亓饔脩暨@里指的是上月沒有消費,本月又有消費的,時間長短取決于上面的分析結(jié)果??梢钥吹交钴S用戶和回流用戶的占比變化和消費趨勢是相同的,12月份有了一個明顯的下滑。 pivoted_purchase_return = pivoted_counts.applymap(lambda x: 1 if x > 1 else np.NaN if x == 0 else 0)pivoted_purchase_return.head()
(pivoted_purchase_return.sum() / pivoted_purchase_return.count()).plot(figsize = (10,6))
可以看到,在穩(wěn)定的時期,復(fù)購率在30% - 40%,還是非??捎^的。 def purchase_back(data): status = [] for i in range(12): if data[i] == 1: if data[i+1] == 1: status.append(1) if data[i+1] == 0: status.append(0) else: status.append(np.NaN) status.append(np.NaN) return pd.Series(status, index=columns_month)pivoted_purchase_back = df_purchase.apply(purchase_back, axis=1)pivoted_purchase_back.head()
(pivoted_purchase_back.sum() / pivoted_purchase_back.count()).plot(figsize = (10,6))
在穩(wěn)定時期,用戶回購率隨著時間變化有所上升,回購率約在35% - 50%,也是較高的。關(guān)鍵詞:分析,報告,單數(shù)
微信公眾號
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。