-
Notifications
You must be signed in to change notification settings - Fork 332
Add row slicing #110
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
Add row slicing #110
Conversation
|
This syntax is a tad confusing because we've only had stuff like |
|
Is there currently another way of easily grabbing a few rows? This is a
common enough operation that I presumed I must have missed it.
|
|
Nice suggestion, but tables are indexed by column name rather than number. You could change Currently |
|
@stefanv There's Table.take which students have seen before. |
|
Can take receive slices as input?
|
|
@papajohn This is an interesting design decision. Isn't it much more common
to slice out rows than to select columns?
|
|
In our course, the first table manipulation is to create new columns from existing columns. Named columns make the resulting expressions fairly easy to interpret. E.g. http://data8.org/text/1_data.html#tables Most of our examples don't pick out rows based on index, but instead based on their contents (e.g., using |
|
@stefanv |
|
take by index Both produce a new table.
|
|
@papajohn Thanks for the link to the notes, I see now that the column syntax is often used for operations such as One way to do this would be to repurpose Indexing by range is probably fine for smaller queries, but becomes expensive for larger ones: Has a design decision been made on whether a |
|
See #120. |
This lets Tables behave similar to other Python containers, such that: