Skip to content

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

@applegrew

Description

@applegrew

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 (

return value === undefined || value === null || (isNaN(value as any) && typeof value !== "string");
) and it removes all values if they are not string or number. In my case I have JS objects which internally have data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions