-
Notifications
You must be signed in to change notification settings - Fork 326
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
Minor improvements from last couple of Book Clubs #8034
Conversation
Add type checking for zip. Add Range->Vector conversion. Add Date_Range->Vector conversion.
Fix tests.
sheet : Text | Integer -> Table | ||
sheet self name:(Text|Integer) = | ||
self.read_section (Excel_Section.Worksheet name 0 Nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggesting an alternative name for this: get_sheet
IMHO it sounds a bit better here, but not strongly attached to it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sheet
is consistent with the Excel VBA API.
Test.specify "should allow building the map from two vectors" <| | ||
expected = Map.empty . insert 0 0 . insert 3 -5 . insert 1 2 | ||
Map.from_keys_and_values [0, 3, 1] [0, -5, 2] . should_equal expected | ||
|
||
Test.specify "should allow building the map from vector like things" <| | ||
expected = Map.empty . insert 0 0 . insert 1 -5 . insert 2 2 | ||
Map.from_keys_and_values (0.up_to 3) [0, -5, 2] . should_equal expected | ||
|
||
Test.specify "should not allow building with duplicate keys unless explicitly allowed" <| | ||
expected = Map.empty . insert 0 0 . insert 3 -5 . insert 1 2 | ||
Map.from_keys_and_values [0, 3, 1, 0] [3, -5, 2, 0] . should_fail_with Illegal_Argument | ||
Map.from_keys_and_values [0, 3, 1, 0] [3, -5, 2, 0] error_on_duplicates=False . should_equal expected | ||
|
||
Test.specify "should not allow different length vectors when building" <| | ||
Map.from_keys_and_values [0, 3, 1] [3, -5, 2, 0] . should_fail_with Illegal_Argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO it feels a bit weird to use this instead of Map.from_vector
- the keys and values are kind of 'detached' from one another.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I liked it when combined with the Range conversions, but yes no real reason you can't use zip
then from_vector
just makes it a one step process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I'm not sure if I understand the use-case with Range conversions here. Could you please give an example?
Is this essentially needed because we still don't have the Map literal? Or is it a separate problem?
Because if it's the Map literal thing - maybe we could mark this as UNSTABLE
and use for now but reserve the right to remove later once Map literal appears?
@@ -144,7 +144,8 @@ type Array | |||
sort self (order = Sort_Direction.Ascending) on=Nothing by=Nothing on_incomparable=Problem_Behavior.Ignore = | |||
Vector.sort self order on by on_incomparable | |||
|
|||
## GROUP Selections | |||
## ALIAS first, last, slice, sample | |||
GROUP Selections |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add to .drop as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought about it but drop is inverse so didnt feel right
Pull Request Description
sheet
toExcel_Workbook
to give familiar API to read sheet.Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.