熊猫 - 最小和最大功能
的最小功能和最大功能,
独特物品列表的方法,然后打印每列的最小值和最大值
示例:
月 | T恤 | 帽 | 销售 |
---|---|---|---|
我想知道是否有一种获取 | 我正在使用python | 200 | 696 |
Feb | 500 | 359 | 855 |
3月 | 685 | 252 | 100 |
JAN | 885 | 598 266 | 266 |
FEB | 1001 | 223 | 1000 |
MAR | 882 | 298 | 754 |
我想在这里做的是找到每个类别的最低和最大销售额
所需的输出
一个月 | 最大销售 | 最小销售最大销售 | 最大帽子销售 | 最大帽子销售 | 最大销售最大销售 | 最低销售最小销售 |
---|---|---|---|---|---|---|
1月 | 885 | 757 | 598 | 598 598 | 696 266 | 266 |
FEB | 1001 | 500 | 223 | 359 | 1000 | 855 |
MAR | 882 | 685 | 298 | 252 | 754 | 100 |
有一个简单的方法是否必须分别为每列获得最小和最大的情况,然后将其附加到DF?
谢谢
I am playing with the min and max functions in python
I'm wondering if there's a way to get a unique list of items and then print the min and max values of each column
example:
Month | T-shirt Sales | Hat Sales | short Sales |
---|---|---|---|
Jan | 757 | 200 | 696 |
Feb | 500 | 359 | 855 |
Mar | 685 | 252 | 100 |
Jan | 885 | 598 | 266 |
Feb | 1001 | 223 | 1000 |
Mar | 882 | 298 | 754 |
What I'd like to do here is find the min and max sales per month for each category
Desired Output
Month | Max TS Sales | Min TS Sales | Max Hat Sales | Min Hat Sales | Max Short Sales | Min short Sales |
---|---|---|---|---|---|---|
Jan | 885 | 757 | 598 | 598 | 696 | 266 |
Feb | 1001 | 500 | 223 | 359 | 1000 | 855 |
Mar | 882 | 685 | 298 | 252 | 754 | 100 |
Is there a simple way to do this or is it a case that I'll have to get the min and max for each column separately and append to a DF?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)