danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

`DataFrame.apply` passes empty row to callback when the cell has objects as values

Open applegrew opened this issue 3 years ago • 0 comments

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:

  1. Go to https://codesandbox.io/s/summer-forest-xzq2rq?file=/src/index.js
  2. 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.

applegrew avatar Jul 06 '22 02:07 applegrew