August 2021
Beginner to intermediate
112 pages
1h 29m
English
| Puzzle 4 | Round and Round We Go |
| | import pandas as pd |
| | |
| | s = pd.Series([-2.5, -1.5, -0.5, 0.5, 1.5, 2.5]) |
| | print(s.round()) |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will print the following:
| | 0 -2.0 |
| | 1 -2.0 |
| | 2 -0.0 |
| | 3 0.0 |
| | 4 2.0 |
| | 5 2.0 |
| | dtype: float64 |
Rounding seems easy. round(1.1) evaluates to 1 and round(1.8) evaluates to 2. The question is, how do you round the .5 numbers? Should ...
Read now
Unlock full access