python - 仅将一个数据帧的日期时间索引保留在另一个数据帧中
问题描述
我试图只保留一个数据帧的索引。两个索引都是 DateTimeindex。
但是,当我应用以下内容时:
df_noisy_test = df_noisy[df_noisy.index.isin(filtered.index)] # match index of test with filtered to remove imputed datapoints
我发现两个数据框的形状不同如下:
(5061, 1)
fordf_noisy_test
和(5056, 1)
forfiltered
如何确保索引df_noisy_test
与filtered
仅使用/获取其索引的索引完全一致
(注意:两个数据帧都使用相同类型的 DateTimeIndex)
解决方案
推荐阅读
- vue.js - Vuejs v-show 和 v-if ,数据显示后立即隐藏
- java - 具有不同父级的实体和服务的 Spring Boot JPA
- java - 如何在双方使用 Active-mq (jBoss EAP 7.2) 配置远程队列
- python - 有没有办法在 Pygame 中更改导入的 .obj 文件的位置和大小?
- c# - 绑定不适用于 xamarin 形式的 MVVM。未找到“ItemSelected”的属性、可绑定属性或事件,
- python-3.x - Python3.5-如何从函数内部删除(释放GPU内存)变量
- cassandra - Cassandra - 在插入过程中截断表
- postgresql - \set 命令在 EDB Postgresql 中
- azure-devops - 无法从 VS 2019 连接到 Azure DevOps 服务器
- mysql - 为什么 MySQL 拒绝以下查询?