Python and NumPy

Retrieve the requested mornings

BOTIE

Gather the requested day rows, then swap rows and columns so each output row follows one greenhouse through those requested days.
Ready to test
0 passed · 0 failed · 1 not run

An empty floor. Start with the information your machine needs.

Received result

Your answer will arrive here.

Examples, experiments and workspace controls
Live values

Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.

Try your own inputs

Use a copy of the example to try your own data. Keep the problem's assumptions in mind, and predict the effect of a change before checking the output. You can also add another branch to compare two ways of doing the calculation.

Start at an output arrow, then click or drag to an input. Drag empty space to pan. Delete removes a selection. Ctrl/Cmd+Z undoes a change.
Context for this challenge

Gather the requested day rows, then swap rows and columns so each output row follows one greenhouse through those requested days.

Botie's requested day list is a sequence of requests. Repeating a day is meaningful and must survive selection.

Gather day rows using the supplied indices, including repeats, then transpose the selected table.

Examples and results
Days by greenhouse
102030
142236
162438
Requested day indices
  1. 02
  2. 10
Required result
1610
2420
3830
Try a fresh construction

This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.

Stuck? Inspect a worked construction

The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.

Assumptions and test precision

These workshop wires carry values rather than shared NumPy storage. Copy and view behaviour is demonstrated and checked in Python. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

Request the last day twice

This check uses the pieces from “Follow each greenhouse through requested days”.

BOTIE

The report requests day indices 3, 1 and 3 from a four-day log. Predict the greenhouse-by-request table. Keep both requests for the last day.
Days by greenhouse
78
1012
1316
1520
Requested day indices
  1. 03
  2. 11
  3. 23

Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.

Build a construction in the workspace above first. This case will test those pieces.

What information would be lost if the requested indices were sorted or deduplicated before gathering?

An index list carries order and multiplicity, both of which can matter in later resampling.

These workshop wires carry values rather than shared NumPy storage. Copy and view behaviour is demonstrated and checked in Python.

Work through the Python challenges →
Continue the coursePut the Same Readings Into the Right Arrangement →
← Preparing the Arrays We Need