在发票上查看哪些物品一起出售
我正在使用 python 。
我正在使用 CSV 。
我正在使用 pandas.dataframe 。
我喜欢1.000.000发票。
发票具有以下格式:
发票1:
- 梨
- 苹果
- 橙
发票2:
- 猕猴桃
- 橘皮
- 菠萝
发票3:
- melon
梨 - 西瓜
...
我想要为此:
梨
通常以:
- 苹果
- 橙色
- 瓜 - 水上
有任何有效的到达那里的方法吗?
提前致谢。
I am working with python.
I am working with csv.
I am working with pandas.DataFrame.
I have like 1.000.000 invoices.
The invoices have the following format:
Invoice 1:
- Pear
- apple
- orange
Invoice 2:
- kiwi
- tangerine
- pineapple
Invoice 3:
- melon
- Pear
- watermelon
...
I want to get this:
Pear
is usually sold with:
- apple
- orange
- melon
-watermelon
Any efficient way to get there?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这称为市场篮分析。
Python软件包mlxtend.frequent_patterns可以为您做到这一点。
有许多文章向您展示了如何做到这一点,以下是这样有用的文章:
https://pbpython.com/market-basket-basket-analysis.html
This is called market basket analysis.
Python package mlxtend.frequent_patterns can do this for you.
There are numerous articles that show you how to do this, below is one such useful one:
https://pbpython.com/market-basket-analysis.html