TinoGehlert / md_plot

Draws a mirrored density plot for each input column
GNU General Public License v3.0
2 stars 1 forks source link

pareto_density_estimation.py:131 AttributeError: 'numpy.ndarray' object has no attribute 'append' #2

Closed andres-erbsen closed 2 years ago

andres-erbsen commented 3 years ago
import md_plot; md_plot.MDplot([3693036, 3675328, 3674384, 3675748, 3675840, 3726368, 3675284, 3676184, 3674300, 3688156, 3673884, 3673888, 3673836, 3673828, 3673884, 3725313, 3673280, 3673476, 3674792, 3683360, 3673320, 3675696, 3674900, 3677188, 3725892, 3674108, 3674868, 3677104, 3683504, 3673188, 3673152, 3673252, 3673176, 3673252, 3724097, 3672816, 3673724, 3673944, 3681124, 3672584, 3672560, 3672584, 3672584, 3725172, 3672460, 3672408, 3672412, 3679688, 3673556, 3673412, 3674652, 3672500, 3672480, 3723484, 3672180, 3672136, 3672136, 3679468, 3672136, 3672404, 3672136, 3672248, 3722929, 3671900, 3673032, 3671992, 3678696, 3671924, 3671920, 3671944, 3671900, 3671884, 3723476, 3671788, 3671788, 3671788, 3686300, 3671612, 3674584, 3671788, 3671784, 3673028, 3675776, 3671768, 3671784, 3683252, 3672252, 3671788, 3671784, 3672944, 3671828, 3672836, 3673112, 3671956, 3672920, 3682692, 3671804, 3671784, 3671788, 3671788, 3671784, 3671788, 3671788, 3671788, 3678188, 3672732, 3671788, 3672984, 3675840, 3671768, 3671788, 3671784, 3671788, 3671788, 3682848, 3671812, 3671788, 3671788, 3671828, 3671788, 3671976, 3671788, 3671788, 3672392, 3684528, 3671792, 3671788, 3671788, 3671788, 3671788, 3671784, 3671788, 3671788, 3679128, 3672864, 3672652, 3672164, 3674096, 3671788, 3671788, 3672336, 3676000, 3671772, 3679444, 3671812, 3671832, 3671784, 3671788, 3672336, 3671972, 3672356, 3673088, 3679488, 3671816, 3671784, 3671788, 3671788, 3671784, 3671788, 3671788, 3671788, 3671784, 3681548, 3671792, 3671788, 3672376, 3675776, 3671768, 3671784, 3671788, 3671788, 3679444, 3671816, 3671788, 3672920, 3672396, 3672980, 3673132, 3671852, 3673004, 3672860, 3679824, 3671816, 3671788, 3671784, 3671788, 3671788, 3671788, 3671848, 3671788, 3678820, 3673528, 3675840, 3671768, 3671788, 3671784])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/browse/.local/lib/python3.9/site-packages/plotnine/ggplot.py", line 97, in __repr__
    self.__str__()
  File "/home/browse/.local/lib/python3.9/site-packages/plotnine/ggplot.py", line 88, in __str__
    self.draw(show=True)
  File "/home/browse/.local/lib/python3.9/site-packages/plotnine/ggplot.py", line 205, in draw
    self._build()
  File "/home/browse/.local/lib/python3.9/site-packages/plotnine/ggplot.py", line 300, in _build
    layers.compute_statistic(layout)
  File "/home/browse/.local/lib/python3.9/site-packages/plotnine/layer.py", line 73, in compute_statistic
    l.compute_statistic(layout)
  File "/home/browse/.local/lib/python3.9/site-packages/plotnine/layer.py", line 324, in compute_statistic
    data = self.stat.compute_layer(data, params, layout)
  File "/home/browse/.local/lib/python3.9/site-packages/plotnine/stats/stat.py", line 276, in compute_layer
    return groupby_apply(data, 'PANEL', fn)
  File "/home/browse/.local/lib/python3.9/site-packages/plotnine/utils.py", line 634, in groupby_apply
    lst.append(func(d, *args, **kwargs))
  File "/home/browse/.local/lib/python3.9/site-packages/plotnine/stats/stat.py", line 274, in fn
    return cls.compute_panel(pdata, pscales, **params)
  File "/home/browse/.local/lib/python3.9/site-packages/md_plot/helper/stat_pde_density.py", line 38, in compute_panel
    data = super(cls, cls).compute_panel(data, scales, **params)
  File "/home/browse/.local/lib/python3.9/site-packages/plotnine/stats/stat.py", line 307, in compute_panel
    new = cls.compute_group(old, scales, **params)
  File "/home/browse/.local/lib/python3.9/site-packages/md_plot/helper/stat_pde_density.py", line 90, in compute_group
    dens = compute_pdedensity(data["y"])
  File "/home/browse/.local/lib/python3.9/site-packages/md_plot/helper/stat_pde_density.py", line 73, in compute_pdedensity
    dens = pareto_density_estimation(x)
  File "/home/browse/.local/lib/python3.9/site-packages/md_plot/helper/pareto_density_estimation.py", line 131, in pareto_density_estimation
    kernels.append(minData)
AttributeError: 'numpy.ndarray' object has no attribute 'append'

Removing the last element from the data series makes plot generation succeed.

TinoGehlert commented 2 years ago

thanks for that bug report, it is fixed with version 0.1.10