Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas index between time

i = pd.date_range('2018-04-09', periods=4, freq='1D20min')
ts = pd.DataFrame({'A': [1, 2, 3, 4]}, index=i)
ts
                     A
2018-04-09 00:00:00  1
2018-04-10 00:20:00  2
2018-04-11 00:40:00  3
2018-04-12 01:00:00  4

ts.between_time('0:15', '0:45')
                     A
2018-04-10 00:20:00  2
2018-04-11 00:40:00  3

You get the times that are not between two times by setting start_time later than end_time:

ts.between_time('0:45', '0:15')
                     A
2018-04-09 00:00:00  1
2018-04-12 01:00:00  4
Comment

PREVIOUS NEXT
Code Example
Python :: pandas group by day 
Python :: flask migrate 
Python :: How to select rows in a DataFrame between two values, in Python Pandas? 
Python :: remove last line of text file python 
Python :: k choose n python 
Python :: django filter by date range 
Python :: how to count the occurrence of a word in string python 
Python :: python web parsing 
Python :: python get weather 
Python :: how to find the data type in python 
Python :: python parallel processing for loop 
Python :: Pandas categorical dtypes 
Python :: how to round in python 
Python :: pandas index to datetime 
Python :: python find directory of file 
Python :: cryptography python 
Python :: python slicing multi dimensional array 
Python :: path in string python 
Python :: python cv2 convert image to binary 
Python :: print list in python 
Python :: how to use path to change working directory in python 
Python :: heroku python buildpack 
Python :: sum all values in a matrix python 
Python :: python exam questions pdf 
Python :: how to hide tensorflow warnings 
Python :: get token from request django 
Python :: sciket learn imputer code 
Python :: numpy.ndarray to lsit 
Python :: how to execute bash commands in python script 
Python :: alpha beta pruning python code 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =