# Python - get coordinates of densest point

I am using numpy and scipy to generate a density plot from 3D coordinate information. I can generate a data density plot successfully by building KDE with the following code

```
xyz = np.vstack([x,y,z])
kde = stats.gaussian_kde(xyz)
density = kde(xyz)
```

But how can I use this information to find the coordinates that are associated with the densest 3D point?

I tried

`max(density)`

which returns a value which then I can find the index with

`density.argmax(axis=0)`

but then I hit a space as I cannot use that index to grab related coordinates from xyz and I am not sure if this is the correct approach.

+3

source to share