danfojs
danfojs copied to clipboard
`DataFrame.apply` passes empty row to callback when the cell has objects as values
Describe the bug
DataFrame.apply removes all values of type object. It seems to accept only string or numbers.
To Reproduce Steps to reproduce the behavior:
- Go to https://codesandbox.io/s/summer-forest-xzq2rq?file=/src/index.js
- Open the console.
Expected behavior The callback should be called with non-zero length array.
Danfojs version:
- 1.1.1 (browser)
Additional context
This happens since apply internally removes all values which are "empty". However, the "empty" logic is weird (https://github.com/javascriptdata/danfojs/blob/bdf0a2479f9d40afe01fd902d1bdefaa4cb71446/src/danfojs-base/shared/utils.ts#L94) and it removes all values if they are not string or number. In my case I have JS objects which internally have data.