我们将切换对客户行为进行分析的方式,并开始讨论如何使用数据科学进行更精细的产品级分析。越来越多的公司(尤其是电子商务企业)对利用数据来了解客户如何与不同产品互动和互动的兴趣和需求不断增加。业已证明,严格的产品分析可以帮助企业改善用户参与度和转化率,从而最终带来更高的利润。在本章中,我们将讨论什么是产品分析以及如何将其用于不同的用例。
产品分析是一种从数据中获取见解的方法,这些数据涉及客户如何与所提供的产品互动和互动,不同产品的性能如何以及企业中可观察到的某些弱点和优势。但是,产品分析并不仅限于分析数据。产品分析的最终目的实际上是建立可行的见解和报告,这些信息和报告可以进一步帮助优化和改善产品性能,并根据产品分析的结果生成新的营销或产品创意。产品分析从跟踪事件开始。这些事件可以是客户的网站访问,页面浏览量,浏览器历史记录,购买或客户可以对您提供的产品采取的任何其他操作。然后,我们可以开始分析和可视化这些事件中的任何可观察模式,以创建可行的见解或报告为目标。产品分析的一些共同目标如下:
- 提高客户和产品保留率
通过分析查看和购买的客户,可以确定客户重复购买的商品以及那些重复的顾客。另一方面,您还可以确定客户不购买哪些商品以及有搅动风险的客户。分析和了解重复购买的商品和回头客的共同属性可以帮助您改善保留策略。 - 识别流行和趋势产品
作为零售企业的营销商,重要的是要对流行和趋势产品有很好的了解。这些最畅销的产品是业务的主要收入来源,并提供了新的销售机会,例如交叉销售或捆绑销售。借助产品分析,就能够轻松地识别和跟踪这些流行和流行的产品,并使用这些最畅销的产品生成新的战略来探索不同的机会。 - 根据客户和产品的关键属性对客户和产品进行细分
借助客户资料和产品数据,我们可以使用产品分析根据客户和产品的属性对客户群和产品进行细分。细分产品数据的一些方法是基于它们的盈利能力,销售量,重新订购量和退款数量。通过这些细分,可以得出关于下一步要定位的产品或客户细分的可行见解。 - 制定具有更高ROI的营销策略
产品分析还可以用于分析营销策略的投资回报率(ROI)。通过分析在促销某些项目上花费的营销费用以及从这些产品产生的收入,可以了解什么有效,哪些无效。使用产品分析进行营销ROI分析可以帮助创建更有效的营销策略
在这篇文章里,我会使用一个在线零售的数据集,仍然是来自Kaggle,数据集是OnlineRetail.csv 。我们将讨论如何跟踪流行商品随时间变化的趋势,然后简要讨论如何在营销策略中如何利用这种流行商品数据进行产品推荐。
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
# Input data files are available in the read-only "../input/" directory
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory
import os
for dirname, _, filenames in os.walk('/kaggle/input'):
for filename in filenames:
print(os.path.join(dirname, filename))
# You can write up to 5GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using "Save & Run All"
# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session
/kaggle/input/onlineretail/OnlineRetail.csv
Load packages
import matplotlib.pyplot as plt
import pandas as pd
%matplotlib inline
Load the dataset
df=pd.read_csv(r"../input/onlineretail/OnlineRetail.csv", encoding="cp1252")
df.head(3)
InvoiceNo | StockCode | Description | Quantity | InvoiceDate | UnitPrice | CustomerID | Country | |
---|---|---|---|---|---|---|---|---|
0 | 536365 | 85123A | WHITE HANGING HEART T-LIGHT HOLDER | 6 | 12/1/2010 8:26 | 2.55 | 17850.0 | United Kingdom |
1 | 536365 | 71053 | WHITE METAL LANTERN | 6 | 12/1/2010 8:26 | 3.39 | 17850.0 | United Kingdom |
2 | 536365 | 84406B | CREAM CUPID HEARTS COAT HANGER | 8 | 12/1/2010 8:26 | 2.75 | 17850.0 | United Kingdom |
df.dtypes
InvoiceNo object
StockCode object
Description object
Quantity int64
InvoiceDate object
UnitPrice float64
CustomerID float64
Country object
dtype: object
Product Analytics
Quantity Distribution
ax = df['Quantity'].plot.box(
showfliers=False,
grid=True,
figsize=(10, 7)
)
ax.set_ylabel('Order Quantity')
ax.set_title('Quantity Distribution')
plt.suptitle("")
plt.show()
pd.DataFrame(df['Quantity'].describe())
Quantity | |
---|---|
count | 541909.000000 |
mean | 9.552250 |
std | 218.081158 |
min | -80995.000000 |
25% | 1.000000 |
50% | 3.000000 |
75% | 10.000000 |
max | 80995.000000 |
As you can see from this plot, some orders have negative quantities. This is because the cancelled or refunded orders are recorded with negative values in the Quantity column of our dataset. For illustration purposes in this exercise, we are going to disregard the cancelled orders.
df = df.loc[df['Quantity'] > 0]
Time-series Number of Orders
df['InvoiceDate']=pd.to_datetime(df.InvoiceDate)
monthly_orders_df = df.set_index('InvoiceDate')['InvoiceNo'].resample('M').nunique()
monthly_orders_df
InvoiceDate
2010-12-31 1629
2011-01-31 1120
2011-02-28 1126
2011-03-31 1531
2011-04-30 1318
2011-05-31 1731
2011-06-30 1576
2011-07-31 1540
2011-08-31 1409
2011-09-30 1896
2011-10-31 2129
2011-11-30 2884
2011-12-31 839
Freq: M, Name: InvoiceNo, dtype: int64
ax = pd.DataFrame(monthly_orders_df.values).plot(
grid=Tru