0

Hi,

i'm new to python and I'm having a problem that I'm not able to solve.

I have the following 2D array:

```
valuearray = [['A', '21', '45'], ['A', '12', '23'],
['A', '54', '21'], ['A', '15', '54'],
['B', '23', '53'], ['B', '34', '53'],
['B', '32', '54'], ['B', '24', '13'],
['C', '31', '43'], ['C', '42', '54'],
['C', '35', '54'], ['C', '12', '11']]
A 21 45
A 12 23
A 54 21
A 15 54
B 23 53
B 34 53
B 32 54
B 24 13
C 31 43
C 42 54
C 35 54
C 12 11
```

I need to generate from this array another array that have the unique values of valuearray[0] , the maximum of valuearray[1] for each valuearray[0] and the minimum valuearray[2] for each valuearray[0]

The result would be:

```
resarray[]
A 54 21
B 34 13
C 42 11
```

**what i tried**

```
uniquenames = []
un = []
for i in range(len(valuearray)):
un.append(valuearray[i][0])
uniquenames=uniq(un)
test = []
for ci in range(len(valuearray)):
for gn in range(len(uniquenames)):
if(valuearray[ci][0] == uniquenames[gn]):
# i don't know what to do here
i tried append(valuearray[ci][0] , max(valuearray[ci][1]),min( valuearray[ci][2]))
```

*NOTE: the array might have more than 3 columns and a big number of rows(e.g E, F, G ,...) ... so i need a dynamic result for my problem.*

thank you

*Edited 4 Years Ago by weblover*