Having the following distance matrix `dist`:

```
dist = [[[ 0, 0],
[ 5,  0],
[ 1,  0],
[ 1,  1],
[11,  3],
[ 3,  6],
[ 5,  5]],

[[ 5,  0],
[ 0,  0],
[ 6,  0],
[ 4,  1],
[ 6,  3],
[ 2,  6],
[10,  5]],

[[ 1,  0],
[ 6,  0],
[ 0,  0],
[ 2,  1],
[12,  3],
[ 4,  6],
[ 4,  5]],

[[ 1,  1],
[ 4,  1],
[ 2,  1],
[ 0,  0],
[10,  2],
[ 2,  7],
[ 6,  6]],

[[11,  3],
[ 6,  3],
[12,  3],
[10,  2],
[ 0,  0],
[ 8,  9],
[16,  8]],

[[ 3,  6],
[ 2,  6],
[ 4,  6],
[ 2,  7],
[ 8,  9],
[ 0,  0],
[ 8,  1]],

[[ 5,  5],
[10,  5],
[ 4,  5],
[ 6,  6],
[16,  8],
[ 8,  1],
[ 0,  0]]]

```

I need to build a `generator expression` with `AND` conditions like this:

```
gexp = (dist[:, :, 0] <= 1) & (dist[:, :, 1] <= 2)

```

meaning that I want a value of `True` when both conditions hold (for columns 0 and 1), like below (I printed it moving to a list comprehension syntax):

```
[array([[ True, False,  True,  True, False, False, False],
       [False,  True, False, False, False, False, False],
       [ True, False,  True, False, False, False, False],
       [ True, False, False,  True, False, False, False],
       [False, False, False, False,  True, False, False],
       [False, False, False, False, False,  True, False],
       [False, False, False, False, False, False,  True]])]

```

I have this list of columns:

```
columns = ['weight', 'height']

```

their thresholds:

```
thresholds = {'weight': 1.0, 'height': 1.0}

```

and their corresponding indexes:

```
indexes = {'weight': 0, 'height': 1}

```

I try to build my generator expression this way:

```
    dynamic_gexpr = [dist[:,:,indexes.get(column)] <= thresholds.get(column) for column in columns]

```

but I don't know how to add the AND conditions between one column and the other. The above expression seems to handle it as if they were more like OR conditions, giving the following output:

```
[array([[ True, False,  True,  True, False, False, False],
       [False,  True, False, False, False, False, False],
       [ True, False,  True, False, False, False, False],
       [ True, False, False,  True, False, False, False],
       [False, False, False, False,  True, False, False],
       [False, False, False, False, False,  True, False],
       [False, False, False, False, False, False,  True]]), array([[ True,  True,  True,  True, False, False, False],
       [ True,  True,  True,  True, False, False, False],
       [ True,  True,  True,  True, False, False, False],
       [ True,  True,  True,  True, False, False, False],
       [False, False, False, False,  True, False, False],
       [False, False, False, False, False,  True,  True],
       [False, False, False, False, False,  True,  True]])]

```