時(shí)間:2023-03-15 23:32:01 | 來源:電子商務(wù)
時(shí)間:2023-03-15 23:32:01 來源:電子商務(wù)
一、項(xiàng)目描述df = pd.read_csv('F:/pycharm project data//taobao/phone//final_goods_info.csv', encoding='utf-8', index_col=0)print(df.columns)
這里我們可以把字段氛圍四類df.fillna(0, inplace=True)
然后我們需要將頻次的數(shù)據(jù)轉(zhuǎn)化為以及其他一些有實(shí)際意義的數(shù)字轉(zhuǎn)化為int型cols = ['itemid', 'category', 'sellerId', 'isTmall', 'comment_count', '系統(tǒng)很強(qiáng)大', '手機(jī)不錯(cuò)', '用得久', '手機(jī)一般', '電池_1', '電池_0', '信號_1', '信號_0', '性價(jià)比_1', '功能_1', '功能_0', '音質(zhì)_1', '音質(zhì)_0', '屏幕_1', '屏幕_0', '正品_1', '軟件_1', '軟件_0', '按鍵_1', '按鍵_0', '外觀_1', '外觀_0', '拍照_1', '拍照_0', '手感_1', '死機(jī)_1', '配件_1', '配件_0', '包裝_1', '贈(zèng)品_1', '贈(zèng)品_0', '物流_1', '物流_0', '視頻_1', '發(fā)熱_1', '發(fā)熱_0', '輕便_1', '操作_1', '性價(jià)比_0', '正品_0', '手感_0', '死機(jī)_0', '包裝_0', '總體_1', '總體_0', '視頻_0', '輕便_0', '操作_0']for col in cols: df[col] = df[col].astype('int64')
對于用戶分組的信息,如果發(fā)生缺失則代表,該商品中沒有提及到手機(jī)適合的用戶對象,所以我們用空值進(jìn)行填充df.loc[df['年齡分組'] == 0, ['年齡分組']] = ''df.loc[df['角色分組'] == 0, ['角色分組']] = ''
②異常值的處理# 用分位數(shù)法去除異常值high_q = df['price'].quantile(q=0.75)# 上四分位數(shù)low_q = df['price'].quantile(q=0.25)# 下四分位數(shù)interval = (high_q - low_q)# 分位數(shù)間隔df = df.loc[(df['price'] > low_q - 3*interval) & (df['price'] < high_q + 3*interval), ]
去除異常數(shù)據(jù)之后,我們再來看一下各品牌手機(jī)的價(jià)格情況:# 對價(jià)格進(jìn)行分箱處理labels = list(np.arange(60))counts, bins_edge = np.histogram(df['price'], bins=60)df['分組'] = pd.cut(df['price'], bins=bins_edge, labels=labels, include_lowest=True)price_list = []for bin_price in bins_edge: price_list.append(round(bin_price, 1))df['分組'] = pd.cut(df['price'], bins=bins_edge, labels=labels, include_lowest=True)plt.figure(figsize=(20, 10))sns.barplot(x=price_list[1: 61], y=counts)plt.xticks(rotation=90)plt.ylabel('count')plt.title('price')plt.show()
結(jié)果如下:# 按照價(jià)格分組數(shù)據(jù)進(jìn)行切分gp_df = df.groupby('分組')# 價(jià)格和銷量的曲線圖g_sales_amount = gp_df['sales_amount'].agg(sum)plt.figure(figsize=(20, 12))sns.pointplot(x=np.arange(60), y=g_sales_amount.values[0: 60], color='r')plt.title('price-sales_amount')plt.xlabel('price')plt.xticks(rotation=90)plt.ylabel('sales_amount')plt.show()# 價(jià)格和銷售量的關(guān)系g_sales_volume = gp_df['sales_volume'].agg(sum)plt.figure(figsize=(20, 12))sns.pointplot(x=np.arange(60), y=g_sales_volume.values[0: 60], color='r')plt.title('price-sales_volume')plt.xlabel('price')plt.xticks(rotation=90)plt.ylabel('sales_volume')plt.show()# print(bins_edge)
對比價(jià)格和銷量,價(jià)格和銷售額的的關(guān)系,我們可以得出以下信息:# 舍去價(jià)格位于0-175的價(jià)位之間的產(chǎn)品df = df.loc[df['分組'] != 0, ]# 按照價(jià)格分組數(shù)據(jù)進(jìn)行切分gp_df = df.groupby('分組')# 價(jià)格和銷量的曲線圖g_sales_amount = gp_df['sales_amount'].agg(sum)plt.figure(figsize=(20, 12))sns.pointplot(x=np.arange(60), y=g_sales_amount.values[0: 60], color='r')plt.title('price-sales_amount')plt.xlabel('price')plt.xticks(rotation=90)plt.ylabel('sales_amount')plt.show()# 價(jià)格和銷售量的關(guān)系g_sales_volume = gp_df['sales_volume'].agg(sum)plt.figure(figsize=(20, 12))sns.pointplot(x=np.arange(60), y=g_sales_volume.values[0: 60], color='r')plt.title('price-sales_volume')plt.xlabel('price')plt.xticks(rotation=90)plt.ylabel('sales_volume')plt.show()# print(bins_edge)
我們現(xiàn)在可以發(fā)現(xiàn),當(dāng)剔除了0-175之間特殊消費(fèi)的影響后,銷售額和銷售量隨價(jià)格波動(dòng)的具有非常高的一致性,仍然有兩個(gè)關(guān)鍵的位置,一個(gè)位置是6,對應(yīng)1049.9-1224.9元的價(jià)格區(qū)間;一個(gè)是31的位置,對應(yīng)的是5424.5-5599.5元的價(jià)格區(qū)間。價(jià)格低于1224.9時(shí),銷量和銷售額隨著價(jià)格的升高而升高;當(dāng)價(jià)格位于1224.9-5424.5元區(qū)間內(nèi)時(shí),價(jià)格和銷售量和銷售額之間都呈現(xiàn)出反復(fù)脈沖的關(guān)系;當(dāng)價(jià)格為5424.5-5599.5元區(qū)間內(nèi)的時(shí)候銷售額和銷售量都出現(xiàn)顯著的波峰;當(dāng)價(jià)格高于5599.5元的時(shí)候,銷售量和銷售額都隨著價(jià)格升高急劇下降。# 總體市場分析df['市場分組'] = ''df.loc[df['分組'].isin(list(np.arange(0, 7))), ['市場分組']] = 'low_market'df.loc[df['分組'].isin(list(np.arange(7, 31))), ['市場分組']] = 'medium_market'df.loc[df['分組'].isin(list(np.arange(31, 60))), ['市場分組']] = 'high_market'print(df.head(100))market_a_df = df.groupby('市場分組')['sales_amount'].sum().sort_values(ascending=False)market_v_df = df.groupby('市場分組')['sales_volume'].sum().sort_values(ascending=False)# 市場銷售額和銷售量分析plt.figure(figsize=(10, 10))plt.pie(market_a_df, labels=market_a_df.index, autopct="%1.1f%%")plt.title('market_amount')plt.show()plt.figure(figsize=(10, 10))plt.pie(market_v_df, labels=market_v_df.index, autopct="%1.1f%%")plt.title('market_volume')plt.show()
對比銷售額和銷售量在各個(gè)市場中的占比情況,我們可以得到以下信息:# 低端市場用戶分布研究low_df = df.loc[df['分組'].isin(list(np.arange(0, 7))), ]g_low_df = low_df.groupby('年齡分組')['sales_amount'].sum().sort_values(ascending=False)# 低端市場的用戶分布plt.figure(figsize=(10, 10))plt.pie(g_low_df, labels=g_low_df.index, autopct="%1.1f%%")plt.title('low_market_user')plt.show()
在上面的圖中,左邊是低端市場中用戶按照年齡分類后的分布情況,右邊是我國目前的人口結(jié)構(gòu)中的年齡分布情況。對比我們可以發(fā)現(xiàn)在低端市場中,主要是老年人用戶群體,占比超過53.3%,這非常符合我們的預(yù)期。但是我們也要注意到,按照低端市場在總市場占比50.5%,低端市場的用戶中年人占比33.9%,中年人在我國人口結(jié)構(gòu)中占比71.2%來計(jì)算,這部分中年人用戶是一個(gè)龐大的基數(shù)。那這部分中年人的消費(fèi)為什么會(huì)在低端市場?# 低端市場中年人用戶畫像研究cols = ['系統(tǒng)很強(qiáng)大', '手機(jī)不錯(cuò)', '用得久', '手機(jī)一般', '電池_1', '電池_0', '信號_1', '信號_0', '性價(jià)比_1', '功能_1', '功能_0', '音質(zhì)_1', '音質(zhì)_0', '屏幕_1', '屏幕_0', '正品_1', '軟件_1', '軟件_0', '按鍵_1', '按鍵_0', '外觀_1', '外觀_0', '拍照_1', '拍照_0', '手感_1', '死機(jī)_1', '配件_1', '配件_0', '包裝_1', '贈(zèng)品_1', '贈(zèng)品_0', '物流_1', '物流_0', '視頻_1', '發(fā)熱_1', '發(fā)熱_0', '輕便_1', '操作_1', '性價(jià)比_0', '正品_0', '手感_0', '死機(jī)_0', '包裝_0', '總體_1', '總體_0', '視頻_0', '輕便_0', '操作_0']# 進(jìn)行用戶分組分析g_low_um_df = low_df.loc[df['年齡分組'] == '中年人', cols].sum(axis=0).sort_values(ascending=False)# 中年人用戶關(guān)注性能分析plt.figure(figsize=(10, 10))plt.pie(g_low_um_df[0: 10], labels=g_low_um_df.index[0: 10], autopct="%1.1f%%")plt.title('low_muser_point')plt.show()#中年人品牌分析bm_df = low_df.loc[df['年齡分組'] == '中年人']g_low_bm_df = bm_df.groupby('brand')['sales_amount'].sum().sort_values(ascending=False)# 中年人用戶品牌分析plt.figure(figsize=(10, 10))plt.pie(g_low_bm_df[0: 8], labels=g_low_bm_df.index[0: 8], autopct="%1.1f%%")plt.title('low_muser_brand')plt.show()
在上面的圖中,左邊是中年人用戶對手機(jī)某方面屬性關(guān)注的占比情況,右邊為中年人用戶對品牌的偏好。可以發(fā)現(xiàn)中年人用戶更為關(guān)注手機(jī)的整體性能,以及外觀方面的屬性,更青睞于榮耀,華為和小米三個(gè)品牌。(注意這里把榮耀和華為拆開是為了后面的對比方便)# 低端市場用戶畫像研究cols = ['系統(tǒng)很強(qiáng)大', '手機(jī)不錯(cuò)', '用得久', '手機(jī)一般', '電池_1', '電池_0', '信號_1', '信號_0', '性價(jià)比_1', '功能_1', '功能_0', '音質(zhì)_1', '音質(zhì)_0', '屏幕_1', '屏幕_0', '正品_1', '軟件_1', '軟件_0', '按鍵_1', '按鍵_0', '外觀_1', '外觀_0', '拍照_1', '拍照_0', '手感_1', '死機(jī)_1', '配件_1', '配件_0', '包裝_1', '贈(zèng)品_1', '贈(zèng)品_0', '物流_1', '物流_0', '視頻_1', '發(fā)熱_1', '發(fā)熱_0', '輕便_1', '操作_1', '性價(jià)比_0', '正品_0', '手感_0', '死機(jī)_0', '包裝_0', '總體_1', '總體_0', '視頻_0', '輕便_0', '操作_0']# 進(jìn)行用戶分組分析g_low_u_df = low_df[cols].sum(axis=0).sort_values(ascending=False)# 低端市場用戶關(guān)注性能分析plt.figure(figsize=(10, 10))plt.pie(g_low_u_df[0: 10], labels=g_low_u_df.index[0: 10], autopct="%1.1f%%")plt.title('low_user_point')plt.show()#低端市場品牌分析g_low_m_df = low_df.groupby('brand')['sales_amount'].sum().sort_values(ascending=False)# 中年人用戶品牌分析plt.figure(figsize=(10, 10))plt.pie(g_low_m_df[0: 8], labels=g_low_m_df.index[0: 8], autopct="%1.1f%%")plt.title('low_user_brand')plt.show()
我們可以發(fā)現(xiàn)低端市場中的用戶畫像和低端市場中中年人的用戶畫像差距非常大,在手機(jī)的屬性方面,低端市場的用戶更為關(guān)注的是手機(jī)的音質(zhì)、功能(手機(jī)的基本功能,例如電打電話、上網(wǎng)等)方面的屬性,這與低端市場中老年人占比較多有關(guān);品牌的偏好上,低端市場的用戶出現(xiàn)了一些不知名的小品牌,榮耀也占一定的比例。# 中端市場用戶畫像研究cols = ['系統(tǒng)很強(qiáng)大', '手機(jī)不錯(cuò)', '用得久', '手機(jī)一般', '電池_1', '電池_0', '信號_1', '信號_0', '性價(jià)比_1', '功能_1', '功能_0', '音質(zhì)_1', '音質(zhì)_0', '屏幕_1', '屏幕_0', '正品_1', '軟件_1', '軟件_0', '按鍵_1', '按鍵_0', '外觀_1', '外觀_0', '拍照_1', '拍照_0', '手感_1', '死機(jī)_1', '配件_1', '配件_0', '包裝_1', '贈(zèng)品_1', '贈(zèng)品_0', '物流_1', '物流_0', '視頻_1', '發(fā)熱_1', '發(fā)熱_0', '輕便_1', '操作_1', '性價(jià)比_0', '正品_0', '手感_0', '死機(jī)_0', '包裝_0', '總體_1', '總體_0', '視頻_0', '輕便_0', '操作_0']# 進(jìn)行用戶分組分析medium_df = df.loc[df['分組'].isin(list(np.arange(7, 31))), ]g_medium_u_df = medium_df[cols].sum(axis=0).sort_values(ascending=False)# 低端市場用戶關(guān)注性能分析plt.figure(figsize=(10, 10))plt.pie(g_medium_u_df[0: 10], labels=g_medium_u_df.index[0: 10], autopct="%1.1f%%")plt.title('medium_user_point')plt.show()#中端市場品牌分析g_medium_m_df = medium_df.groupby('brand')['sales_amount'].sum().sort_values(ascending=False)# 中年人用戶品牌分析plt.figure(figsize=(10, 10))plt.pie(g_medium_m_df[0: 8], labels=g_medium_m_df.index[0: 8], autopct="%1.1f%%")plt.title('medium_user_brand')plt.show()
對比中端市場用戶的畫像和低端市場中中年人的用戶畫像,可以發(fā)現(xiàn)在手機(jī)的屬性方面,中端市場用戶和低端市場中年人的用戶關(guān)注點(diǎn)近似,都是產(chǎn)品的功能(手機(jī)的基本功能,例如電打電話、上網(wǎng)等)、外觀、電池、拍照等;在品牌偏好上蘋果的價(jià)位較高,沒有千元機(jī),所以低端市場的中年人用戶沒有選擇權(quán),但對華為、榮耀、小米幾個(gè)品牌商認(rèn)同度接近。# 中端市場分析gp_df = df.groupby('分組')# 價(jià)格和銷量的曲線圖g_sales_amount = gp_df['sales_amount'].agg(sum)plt.figure(figsize=(20, 12))sns.pointplot(x=np.arange(7, 31), y=g_sales_amount.values[7: 31], color='r')plt.title('price-sales_amount')plt.xlabel('price')plt.xticks(rotation=90)plt.ylabel('medium_sales_amount')plt.show()# 價(jià)格和銷售額的關(guān)系g_sales_volume = gp_df['sales_volume'].agg(sum)plt.figure(figsize=(20, 12))sns.pointplot(x=np.arange(7, 31), y=g_sales_volume.values[7: 31], color='r')plt.title('price-sales_volume')plt.xlabel('price')plt.xticks(rotation=90)plt.ylabel('medium_sales_volume')plt.show()
可以發(fā)現(xiàn)中端市場的價(jià)格和銷售額以及銷售量都存在著反復(fù)脈沖的復(fù)雜關(guān)系,那為什么會(huì)呈現(xiàn)出這種關(guān)系呢?# 中端市場用戶研究g_medium_df = medium_df.groupby('年齡分組')['sales_amount'].sum().sort_values(ascending=False)# 低端市場的用戶分布plt.figure(figsize=(10, 10))plt.pie(g_medium_df, labels=g_medium_df.index, autopct="%1.1f%%")plt.title('medium_market_user')plt.show()
上圖是中端市場用戶的一個(gè)分布圖,由于我們在從評論中挖掘用戶信息的時(shí)候,主要是挖掘在評論中提及到的對象,比如某條評論中可能會(huì)提及到手機(jī)適合老人使用,那么我們就可以挖掘到老人這個(gè)用戶信息,但是對于大部分給自己買手機(jī)的消費(fèi)者來說,不會(huì)表明自己的身份,只會(huì)對產(chǎn)品本身加以評論,所以圖中缺失的80.1%的用戶信息主要集中在中青年,有獨(dú)立的消費(fèi)能力的人群中。# 中端市場價(jià)格多元化與銷售量的關(guān)系pro_list = ['華為', '蘋果', '小米', '榮耀', 'oppo', 'vivo', '三星']g_b_medium_df = medium_df.groupby('brand')['price']price_sum_list = []for i in range(len(pro_list)): b_df = g_b_medium_df.get_group(pro_list[i]).value_counts() price_sum_list.append(len(b_df))# print(price_sum_list)plt.figure(figsize=(12, 8))sns.barplot(x=pro_list, y=price_sum_list)plt.title('medium_market_brand_price')plt.show()g_b_medium_volume_df = medium_df.groupby('brand')['sales_volume']volume_sum_list = []for i in range(len(pro_list)): b_df = g_b_medium_df.get_group(pro_list[i]).sum() volume_sum_list.append(b_df)# print(price_sum_list)plt.figure(figsize=(12, 8))sns.barplot(x=pro_list, y=volume_sum_list)plt.title('medium_market_brand_volume')plt.show()
在上圖中,左邊的圖表示在中端市場中每個(gè)品牌手機(jī)制定的價(jià)格數(shù)量,右邊的圖表示每個(gè)品牌手機(jī)在中端市場中的銷售額,我們可以很明顯的看出一致性非常強(qiáng),既制定價(jià)格數(shù)越多的品牌,其對應(yīng)的銷售額就越多,這也很好的證明了我們上面的結(jié)論。# 高端市場用戶畫像研究high_df = df.loc[df['分組'].isin(list(np.arange(31, 60))), ]cols = ['系統(tǒng)很強(qiáng)大', '手機(jī)不錯(cuò)', '用得久', '手機(jī)一般', '電池_1', '電池_0', '信號_1', '信號_0', '性價(jià)比_1', '功能_1', '功能_0', '音質(zhì)_1', '音質(zhì)_0', '屏幕_1', '屏幕_0', '正品_1', '軟件_1', '軟件_0', '按鍵_1', '按鍵_0', '外觀_1', '外觀_0', '拍照_1', '拍照_0', '手感_1', '死機(jī)_1', '配件_1', '配件_0', '包裝_1', '贈(zèng)品_1', '贈(zèng)品_0', '物流_1', '物流_0', '視頻_1', '發(fā)熱_1', '發(fā)熱_0', '輕便_1', '操作_1', '性價(jià)比_0', '正品_0', '手感_0', '死機(jī)_0', '包裝_0', '總體_1', '總體_0', '視頻_0', '輕便_0', '操作_0']# 進(jìn)行用戶分組分析g_high_u_df = high_df[cols].sum(axis=0).sort_values(ascending=False)# 高端市場用戶關(guān)注性能分析plt.figure(figsize=(10, 10))plt.pie(g_high_u_df[0: 10], labels=g_high_u_df.index[0: 10], autopct="%1.1f%%")plt.title('high_user_point')plt.show()#中端市場品牌分析g_high_m_df = high_df.groupby('brand')['sales_amount'].sum().sort_values(ascending=False)# 中年人用戶品牌分析plt.figure(figsize=(10, 10))plt.pie(g_high_m_df[0: 5], labels=g_high_m_df.index[0: 5], autopct="%1.1f%%")plt.title('high_user_brand')plt.show()
上圖中左邊為高端市場中用戶關(guān)注的手機(jī)屬性分布情況,右圖為高端市場的用戶對品牌的偏好分布情況,對比后我們發(fā)現(xiàn):# 高端市場價(jià)格多元化與銷售量的關(guān)系pro_list = ['華為', '蘋果', '小米', '榮耀', 'oppo', 'vivo', '三星']g_b_high_df = high_df.groupby('brand')['price']price_sum_list = []for i in range(len(pro_list)): b_df = g_b_high_df.get_group(pro_list[i]).value_counts() price_sum_list.append(len(b_df))# print(price_sum_list)plt.figure(figsize=(12, 8))sns.barplot(x=pro_list, y=price_sum_list)plt.title('high_market_brand_price')plt.show()g_b_high_volume_df = high_df.groupby('brand')['sales_volume']volume_sum_list = []for i in range(len(pro_list)): b_df = g_b_high_df.get_group(pro_list[i]).sum() volume_sum_list.append(b_df)# print(price_sum_list)plt.figure(figsize=(12, 8))sns.barplot(x=pro_list, y=volume_sum_list)plt.title('high_market_brand_volume')plt.show()
在上圖中,左邊的圖表示在高端市場中每個(gè)品牌手機(jī)制定的價(jià)格數(shù)量,右邊的圖表示每個(gè)品牌手機(jī)在高端市場中的銷售額,我們可以很明顯的看出華為在高端市場中價(jià)格制定相對比較集中,但是其在銷售額上仍然表現(xiàn)比較好,這其實(shí)反映了華為進(jìn)入高端市場是相對比較謹(jǐn)慎的。# 銷量和銷售額分析g_a_df = df.groupby('brand')['sales_amount'].sum().sort_values(ascending=False)g_v_df = df.groupby('brand')['sales_volume'].sum().sort_values(ascending=False)# 銷售量plt.figure(figsize=(12, 12))plt.pie(g_a_df[0: 8], labels=g_a_df.index[0: 8], autopct="%1.1f%%")plt.title('high_user_brand')plt.show()# 銷售額plt.figure(figsize=(12, 12))plt.pie(g_v_df[0: 8], labels=g_v_df.index[0: 8], autopct="%1.1f%%")plt.title('high_user_brand')plt.show()
在上圖中,左邊的圖表示各品牌的銷量占比,右邊的圖表示每個(gè)品牌手機(jī)銷售額占比。結(jié)合三星在中高端市場多元化的價(jià)格策略分析,我們發(fā)現(xiàn)盡管三星在中端市場和高端市場中實(shí)施了多元化的價(jià)格策略,但是從整體上來看,中高端市場的價(jià)格多元化戰(zhàn)略并沒有給三星帶來整體市場在銷量以及銷售額上的提升。這是什么原因造成的呢?# 各品牌均價(jià)g_mp_df = medium_df.groupby('brand')['price'].mean().sort_values(ascending=False)plt.figure(figsize=(20, 8))sns.barplot(x=g_mp_df.index, y=g_mp_df.values)plt.xticks(rotation=90)plt.title('m_brand_mean_price')plt.show()
我們可以看出在中端市場,銷售額占比較大的幾個(gè)品牌除了蘋果外,華為、小米、榮耀、oppo、vivo的價(jià)格均低于三星。關(guān)鍵詞:挖掘,分析,數(shù)據(jù)
客戶&案例
營銷資訊
關(guān)于我們
微信公眾號
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。