在 Spyder (Python 3.9.7) 中更改列名称并查找平均值和标准差

发布于 2025-01-11 11:42:16 字数 579 浏览 2 评论 0原文

我正在做一个课堂项目,你们都非常有帮助!

无论如何,我使用了这段代码:

SO21= BI21[BI21["OnHand"].eq(0)].groupby("BrandID")["InventoryDate"].nunique()

它生成了这个系列(请告诉我,我仍在学习如何最好地在此处输入我的信息供您查看):

在此处输入图像描述

然后我想查找总和、平均值、标准差和标准误差,并使用了我们在课堂上学到的代码:

SOSummary19 = SO19["InventoryDate"].agg(["sum","mean","std","sem"])

它返回一个 KeyError:“InventoryDate”

My目标是根据我发布的图像中“InventoryDate”列中的数字进行这些测量,我还想将“InventoryDate”重命名为“DaysStockedOut”,

提前感谢您你们的帮助,你们都太棒了!

I'm working on a project for class, and y'all have been so incredibly helpful!

Anyways, I used this code:

SO21= BI21[BI21["OnHand"].eq(0)].groupby("BrandID")["InventoryDate"].nunique()

And it generated this series (please bare with me I'm still learning how to best input my information here for you to see):

enter image description here

I then wanted to find the sum, mean, standard deviation, and standard error and used this code that we learned in class:

SOSummary19 = SO19["InventoryDate"].agg(["sum","mean","std","sem"])

It returns a KeyError: "InventoryDate'

My goal is to take those measurements based on the numbers in the 'InventoryDate' Column from the image I posted, and I would also like to rename 'InventoryDate' to 'DaysStockedOut'

Thank you in advance for your help, you are ALL amazing!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瀞厅☆埖开 2025-01-18 11:42:16

SOSummary19= SO19.agg(["sum","mean","std","sem"]) 是修复

SOSummary19= SO19.agg(["sum","mean","std","sem"]) Was the fix

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文