Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`DataFrame select:` fails when no rows are selected #91

Closed
AtharvaKhare opened this issue May 5, 2019 · 6 comments

Comments

@AtharvaKhare
Copy link
Contributor

commented May 5, 2019

Running the following block:

df := DataFrame withRows: #((1) (2) (3) (4)).
df select: [ :row | (row at: 1) >= 5 ].

leads to SubscriptOutOfBounds: 1, due to first in DataFrameInternal withRows::

numberOfColumns := anArrayOfArrays first size.

Shouldn't it return an empty Dataframe instead?

@olekscode

This comment has been minimized.

Copy link
Member

commented May 5, 2019

Yes, that's definitely a bug!
I think, we can fix it by making sure that DataFrame >> withRows: and all related messages return an empty data frame when given an empty array of rows.

DataFrame withRows: #(). "a DataFrame(0@0)"
@AtharvaKhare

This comment has been minimized.

Copy link
Contributor Author

commented May 5, 2019

Same is true for reject:

df := DataFrame withRows: #((1) (2) (3) (4)).
df reject: [ :row | (row at: 1) <= 5 ].

@olekscode olekscode added the bug label May 5, 2019

@AtharvaKhare

This comment has been minimized.

Copy link
Contributor Author

commented May 5, 2019

Can I take this up and adding related tests?

@olekscode

This comment has been minimized.

Copy link
Member

commented May 5, 2019

I have created a related issue #92 for it

@olekscode

This comment has been minimized.

Copy link
Member

commented May 5, 2019

But don't work on this issue now, because I want to plan and organize all tasks and issues first.
We can discuss it tomorrow evening.

@AtharvaKhare

This comment has been minimized.

Copy link
Contributor Author

commented Jul 22, 2019

Fixed with #100.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.