Skip to content

DataFrame addRow/addColumn doesnt work on empty frames #113

Open

Description

@AtharvaKhare

Code:

x := DataFrame new.
x addRow: #(1 2 3)

Current workaround is:

x := DataFrame withColumnNames: #(1 2 3).
x addRow: #(1 2 3)

This is due to

anArray size = rows
ifFalse: [ SizeMismatch signal ].

Activity

  1. olekscode commented on Jul 26, 2021

    @olekscode
    Member

    It seems like a bug that should be fixed.
    Indeed, it would be nice to create an empty DataFrame and then fill it with values.
    When adding a row, we could check if DataFrame is empty, and if yes, set the number of columns to the size of a new row.

    But I have several doubts:

    1. Do we want to make that check every time we add a row? Will it not slow down the operations that use add: (e.g., collect:, select:, ect.)?
    2. Does it make sense to create a DataFrame with 0 columns and then resize it to fit the first inserted row? Would we do the same for Matrix?

    Perhaps, we should check how this is done in pandas or R.

  2. added this to the v3.0 milestone on Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions