我如何在熊猫的一定时间段内选择最少的NAN值?

发布于 2025-01-29 03:36:18 字数 247 浏览 3 评论 0原文

我的数据集和数据集缺失了很多数据,这些数据将每小时数据存储几年。现在,我将实施一种季节性填充方法,其中我需要二年来我拥有的最佳数据(2*8760条目)。这意味着在接下来的两年中,丢失的数据最少(或最少的NAN值)。然后,我需要以DateTime格式的结束时间和开始时间的开始时间。我的数据存储在索引是每小时DateTime的数据框中。我该如何实现?

编辑: 为了使之更加清晰,我需要从两年(或2*8760行)的时间段中选择所有条目(值和NAN值),其中NAN值最少。

I have dataset with quite a lot data missing which stores hourly data for several years. I would now to implement a seasonal filling method where I need the best data I have for two following years (2*8760 entries). This means the least amount of data missing (or least amount of nan values) for two following years. I then need then the end time and start time of this period in datetime format. My data is stored in a dataframe where the index is the hourly datetime. How can I achieve this?

EDIT:
To make it a bit clearer I need to select all entries (values and nan values) from a time period of of two years (or of 2*8760 rows) where the least amount of nan values occur.

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

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

发布评论

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

评论(1

氛圍 2025-02-05 03:36:18

您可以使用df = df.dropna()从数据中删除所有NAN值

You can remove all the NAN values from your data by using df = df.dropna()

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