yhat / ggpy

ggplot port for python
http://yhat.github.io/ggpy/
BSD 2-Clause "Simplified" License
3.7k stars 572 forks source link

_compute_covariance fails when self.dataset has only same values #599

Closed Rambatino closed 3 years ago

Rambatino commented 7 years ago

On a facet_wrap() using geom_density() when the subset of data equals something like:

self.dataset = [[100, 100, 100, 100, 100]]

_compute_covariance in kde.py errors because:

ipdb> linalg.inv([[0]])
*** numpy.linalg.linalg.LinAlgError: singular matrix

Not sure what the best way to sort this bug out and I'd argue that it isn't a data issue, because it's likely to come up.