lundi 16 novembre 2020

Python mode function gives error for real-valued vector: No unique mode; found 2 equally common values

Why can't statistics.mode find the mode for a normally distributed (therefore, unimodal) random variable, but works fine for vectors containing integers?

import numpy as np
from numpy.random import rand,randn
import statistics as st

y = randn(20)
print(st.mode(y))



Aucun commentaire:

Enregistrer un commentaire