简体   繁体   English

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

[英]Exclude day from Pandas Dataframe date range

If I want to select a range from the following dataframe I can use this command: 如果要从以下数据框中选择一个范围,则可以使用以下命令:

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

How do I exclude a single day (2016-05-30) from the range 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>
frame[frame.index != '2016-05-30'] 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM