I need to go through the TimeStamp
column of a dataframe (row by row). This dataframe has approximately 40,000,000 rows. I'm doing this with for
, it's working. However, it takes a long time. I wonder if you have something faster.
index TimeStamp FAILURE MESSAGE
0 2018-01-01 00:00:00 'DOOR OPEN'
1 2018-01-01 00:00:01 'DOOR OPEN'
2 2018-01-01 00:00:02 'DOOR OPEN'
Code:
cont = 0
for i in range(0, len(df)):
if(df['TimeStamp'].iloc[i] >= '2018-01-01 00:00:01'):
cont +=1