【发布时间】:2017-12-06 04:43:14
【问题描述】:
我正在寻找一种按星期几和/或选定日期过滤多索引数据框的方法,如下所示。假设我需要
- 对
select only mondays的查询; - 我想
select all days except monday and friday的另一个查询; - 用于选择日期输入列表中存在的数据的第三个查询,例如
select all dates in ['2015-05-14', '2015-05-21', '2015-05-22']; - 最后,查询结合了基于星期几和日期列表的选择,例如
select all dates in ['2015-05-14', '2015-05-21', '2015-05-22'] and thursdays。
有什么办法呢?
Col1 Col2 Col3 Col4
Date Two
2015-05-14 10 81.370003 6.11282 39.753 44.950001
11 80.419998 6.03380 39.289 44.750000
C3 80.879997 6.00746 41.249 44.360001
2015-05-19 3 80.629997 6.10465 41.047 40.980000
S9 80.550003 6.14370 41.636 42.790001
2015-05-21 19 80.480003 6.16096 42.137 43.680000
2015-05-22 C3 80.540001 6.13916 42.179 43.490002
【问题讨论】:
标签: python pandas multi-index