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
Closed

DataFrame select: fails when no rows are selected #91

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

Comments

@AtharvaKhare
Copy link
Contributor

@AtharvaKhare AtharvaKhare 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
Copy link
Member

@olekscode olekscode 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)"

Loading

@AtharvaKhare
Copy link
Contributor Author

@AtharvaKhare AtharvaKhare commented May 5, 2019

Same is true for reject:

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

Loading

@olekscode olekscode added the bug label May 5, 2019
@AtharvaKhare
Copy link
Contributor Author

@AtharvaKhare AtharvaKhare commented May 5, 2019

Can I take this up and adding related tests?

Loading

@olekscode
Copy link
Member

@olekscode olekscode commented May 5, 2019

I have created a related issue #92 for it

Loading

@olekscode
Copy link
Member

@olekscode olekscode 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.

Loading

@AtharvaKhare
Copy link
Contributor Author

@AtharvaKhare AtharvaKhare commented Jul 22, 2019

Fixed with #100.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants