How do I obtain the mode estimate from posterior samples?

Hello,

Most of my posteriors are turning out to be bi-modal and using the mean (MAP) estimate is not possible. Instead, I want to use the mode estimate of the posterior samples. Is there an easy way to achieve this? I can plot the kde of posteriors using sns.kdeplot() but can’t seem to find an easy way to get the actual mode estimates. Thanks!

Maybe this stackoverflow thread is helpful - it shows how to find mode of a kde plot.

Anything wrong with scipy.stats.mode — SciPy v1.11.2 Manual?