迭代数据框中的数据的一部分

发布于 2025-02-13 05:32:32 字数 235 浏览 0 评论 0原文

数据: 在excel中可视化的数据

  1. 我的数据集如上所述。
  2. 我可以使用python创建数据框架:首先要进行红色,进行一些计算,保存结果。创建蓝色并进行计算,保存一些数据以及绿色等等?
  3. 帮助!如何!?

Data:
Data visualed in excel

  1. I have dataset as seen above.
  2. Can i use python to create dataframes: first red, do some calculations, save results. Create the blue and do calculations, save some data and green and so on?
  3. HELP! How!?

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

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

发布评论

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

评论(2

二手情话 2025-02-20 05:32:32

您可以从在这里使用pandas/code>并在dataframe df中加载来自Excel文件的数据,然后做类似的事情

for window in df.rolling(window=2):
    # computation on the sliding window...

You can start from here to use pandas and load up the data from the excel file in a dataframe df, then do something like

for window in df.rolling(window=2):
    # computation on the sliding window...
一梦浮鱼 2025-02-20 05:32:32

您需要对需要执行的计算更具体。
但是您要寻找的是一个滚动窗口

df_result = df.rolling(window=size_of_window).apply(func_to_apply)

You need to be more specific about the calculation you need to perform.
But what you are looking for is a rolling window

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