danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

`isEmpty()` throws when used on a `BigInt` type

Open mesili opened this issue 2 years ago • 0 comments

Problem description

isEmpty() throws a Cannot convert a BigInt value to a number.

Related code

https://github.com/javascriptdata/danfojs/blob/f272a7eac7fb0a13be313f15e72d3506136093b6/src/danfojs-base/shared/utils.ts#L93-L95

Solution

Using isNaN(Number(value)) fixes the issue.

Discussion

Looking at the other isNaN() calls in said file it looks like some places are using Number(value) while some others don't.
I suspect some other methods would throw in the same way.

mesili avatar Jul 05 '23 04:07 mesili