从Pandas Dataframe日期范围中排除日期

时间:2016-06-09 19:15:32

标签: python pandas

如果我想从以下数据框中选择一个范围,我可以使用此命令:

bars_specified_days = bars['2016-05-27':'2016-06-03']

如何从2016-05-27:2016-06-03范围内排除一天(2016-05-30)?

bars_specified_days.describe

<bound method NDFrame.describe of Timestamp
2016-06-03 09:31:07      1.0
2016-06-03 09:31:28      1.0
2016-06-03 09:31:30     40.0
2016-06-03 09:31:31      1.0
2016-06-03 09:31:54      2.0
2016-06-03 09:31:55     28.0
2016-06-03 09:32:12     86.0
2016-06-03 09:32:13     17.0
2016-06-03 09:32:17     51.0
2016-06-03 09:32:20    203.0
2016-06-03 09:32:24     30.0
2016-06-03 09:32:29      5.0
2016-06-03 09:32:30      1.0
2016-06-03 09:32:41      1.0
2016-06-03 09:32:49      1.0
2016-06-03 09:32:54      5.0
2016-06-03 09:33:03     10.0
2016-06-03 09:33:09      5.0
2016-06-03 09:33:10      5.0
2016-06-03 09:33:37      7.0
2016-06-03 09:33:42      1.0
2016-06-03 09:33:43      1.0
2016-06-03 09:33:44      1.0
2016-06-03 09:33:53    219.0
2016-06-03 09:33:54      4.0
2016-06-03 09:34:04      1.0
2016-06-03 09:34:08      1.0
2016-06-03 09:34:09     66.0
2016-06-03 09:34:39      5.0
2016-06-03 09:34:47      2.0
                       ...  
2016-06-03 16:14:22      4.0
SNIP......
Name: Volume, dtype: float64>

1 个答案:

答案 0 :(得分:4)

frame[frame.index != '2016-05-30']