Question: Could you please take a look at my code and give me some advice how I might improve my code so it takes less time to process? Main purpose is to look at each row (ID) at test table and find same ID at list table, if it's match then look at time difference between the two identical ID and label them as if it takes less than 1 hours (3600s) or not. 
Thanks in advance

test.csv has two col (ID, time) and 100K rows 
 list.csv has tow col (ID, time) and 40k rows

sample data:
ID Time
83d-36615fa05fb0 2019-12-11 10:41:48 

```
a = -1
for row_index,row in test.iterrows():
   a = a + 1

   for row_index2,row2 in list.iterrows():

       if row['ID'] == row2['ID']:
           time_difference = row['Time'] - row2['Time']
           time_difference = time_difference.total_seconds() 

           if time_difference < 3601 and time_difference > 0:
               test.loc[a, 'result'] = "short waiting time"

```

Answer: 
You can use [**`np.delete`** [numpy-doc]](https://docs.scipy.org/doc/numpy/reference/generated/numpy.delete.html) for that, and use a `slice` object as parameter to remove:

```
>>> np.delete(data, slice(1, 3), 1)
array([[61.  , 15.04, 14.96, 13.17,  9.29, 13.96,  9.87, 13.67, 10.25,
        10.83, 12.58, 18.5 , 15.04],
       [61.  , 14.71, 16.88, 10.83,  6.5 , 12.62,  7.67, 11.5 , 10.04,
         9.79,  9.67, 17.54, 13.83],
       [61.  , 18.5 , 16.88, 12.33, 10.13, 11.17,  6.17, 11.25,  8.04,
         8.5 ,  7.67, 12.75, 12.71]])

```

When you use slicing notation, under the hood you basically pass a `slice` object. Indeed `a[1:3]` is equivalent to `a[slice(1,3)]`.

Furthermore the `1` here specifies the dimension over which we want to remove. Since we wish to remove data for the second dimension, we thus write `1` as third parameter.
If `a` is your `numpy` array and you want to drop the columns: `1,2`, you could do that using the following in a single line. 

```py
import numpy as np

delete_cols = [1,2] # list of column numbers to delete
a[:,list(set(np.arange(a.shape[-1])) - set(delete_cols))]

```

### Some Explanation

What you need here is proper indexing of the array `a`. 

```py
# list_of_column_numbers = [0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
a[:, list_of_column_numbers]

```

> 
> You can make the `list_of_column_numbers` in one of the following ways: 
> 
> 
> 

```py
# Method-1: Direct Declaration
list_of_column_numbers = [0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]

# Method-2A: Using Set and Dropping Columns not Needed
# a.shape[-1] = 15
delete_cols = [1,2] # list of column numbers to delete
list_of_column_numbers = list(set(np.arange(a.shape[-1])) - set(delete_cols))

# Method-2B: Make list of column numbers
# a.shape[-1] = 15
list_of_column_numbers = [0] + np.arange(3,a.shape[-1]).tolist()

```