【问题标题】:Analysis on most popular product combination最受欢迎产品组合分析
【发布时间】:2022-11-12 10:00:33
【问题描述】:
我需要你的帮助以解决以下问题
我们的目标是增加我们在市场上的整体份额——为此,我们想知道向不同国家推出特定的产品组合是否会对我们的市场份额产生影响。
以下是 2021 年 8 月和 9 月和 2022 年期间的模型数据
| Year |
Country |
Product |
Aug_Sales_Euros |
Sept_Sales_Euros |
| 2022 |
Kenya |
20MB_Internet |
12000 |
8000 |
| 2022 |
Kenya |
200min_Call |
7000 |
9000 |
| 2022 |
Kenya |
10MB_100min |
6000 |
5000 |
| 2021 |
USA |
10MB_100min |
9000 |
10000 |
| 2022 |
USA |
20MB_Internet |
60000 |
50000 |
| 2022 |
USA |
900MB_Internet |
12000 |
8000 |
| 2022 |
USA |
400min_Call |
70000 |
8000 |
| 2022 |
USA |
200min_Call |
12000 |
8000 |
| 2021 |
USA |
400min_Call |
50000 |
8000 |
| 2021 |
USA |
200min_Call |
12000 |
8000 |
| 2022 |
FRANCE |
200min_Call |
12000 |
8000 |
| 2021 |
FRANCE |
200min_Call |
12000 |
8000 |
例如,我们想知道,应该在法国以 200min_call 推出哪种产品,以增加我们的整体市场份额?或者现有的哪种产品组合效果最好?仅供参考:我们使用 python 进行分析。
有更多的数据,更多的产品和国家组合
我应该如何解决这个问题,甚至更好,有没有我可以参考的例子?
谢谢,
贾斯汀
【问题讨论】:
标签:
python
machine-learning
linear-regression
analytics
logistic-regression
【解决方案1】:
我相信您的问题应该是一个技术问题,只要我理解,您就在询问分析工作,从 python/pandas 的角度来看,这就是您如何使用您拥有的数据分析数据集,下面的代码将允许您回答上面提出的许多分析问题。
#your data
dfS = pd.read_csv('salesData.csv')
#groupby year, country, product, apply sum to the other columns
dfS = dfS.groupby(['Year','Country','Product']).agg({'Aug_Sales_Euros':'sum','Sept_Sales_Euros':'sum'})
#then you can filter by year in this case I did 2021 and by country
#so you can see the best sales for a specific country per year, you can change for any country you have in your data set
#using this very same filter
dfS[(dfS.index.get_level_values(0) == 2021) & (dfS.index.get_level_values(1) == 'FRANCE')]
#here you can select the year and check the most sold products. 3 largest product sold in the month of August
dfS[dfS.index.get_level_values(0) == 2022].nlargest(3, 'Aug_Sales_Euros')
#here you can select the country and check the most sold products. 3 largest product sold in the month of September
dfS[dfS.index.get_level_values(1) == 'USA'].nlargest(3, 'Sept_Sales_Euros')
#you can also filter country, product as you please
dfS[(dfS.index.get_level_values(0) == 2021) & (dfS.index.get_level_values(1) == 'FRANCE') & (dfS.index.get_level_values(2) == '200min_Call')]