danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

Describe returns error - Cannot calculate mean, unexpected type of argument" when data has nulls

Open slonyik opened this issue 3 years ago • 0 comments

Describe the bug calling describe() returns error:

mean.js:98 Uncaught TypeError: Cannot calculate mean, unexpected type of argument (type: null, value: null)
    at t.improveErrorMessage (improveErrorMessage.js:26:12)
    at mean.js:98:40
    at e (collection.js:53:7)
    at Function.l (mean.js:93:21)
    at mean (typed-function.js:1085:85)
    at t.describe (frame.ts:1403:38)
    at eval (eval at <anonymous> (a.html:1:1), <anonymous>:1:4)
    at a.html:26:11

To Reproduce create csv file aa.csv

c1,c2,c3,c4
0.32,0.35,0.37,0.00
0.27,0.44,0.49,0.00
0.03,0.37,0.27,0.00
0.01,0.30,0.14,0.00
0.09,0.23,0.09,0.00
0.18,0.21,0.13,0.00

load csv via readCSV .

readCSV("aa.csv", { delimitersToGuess: "," })

run describe() on the read object

Expected behavior displays describe/stats on the data.

Screenshots na

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser :FF Developer 105.0b9 (64-bit) , Chrome 105.0.5195.125 (Official Build) (64-bit)
  • Version [e.g. 22]

Smartphone (please complete the following information): N/A

Additional context looks like the $data array contains row with "null"

df.$data[df.$data.length-1]
Array [ null ]

It is not clear if that is intentional - to mark end of the array or bug. If bug, it might come from csv loader/parser...

slonyik avatar Sep 16 '22 16:09 slonyik