numbers = [2, 3, 5]
squared = list()
for number in numbers:
squared.append(number ** 2)
squared[4, 9, 25]
[4, 9, 25]
NameError: name 'new_squared_list' is not defined
Detailed traceback:
File "<string>", line 1, in <module>
Ta-Da!
'Peek-a-boo'
| name | mfr | type | calories | ... | shelf | weight | cups | rating | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | 100% Bran | N | Cold | 70 | ... | 3 | 1.0 | 0.33 | 68.402973 |
| 1 | 100% Natural Bran | Q | Cold | 120 | ... | 3 | 1.0 | 1.00 | 33.983679 |
| 2 | All-Bran | K | Cold | 70 | ... | 3 | 1.0 | 0.33 | 59.425505 |
| 3 | All-Bran with Extra Fiber | K | Cold | 50 | ... | 3 | 1.0 | 0.50 | 93.704912 |
| 4 | Almond Delight | R | Cold | 110 | ... | 3 | 1.0 | 0.75 | 34.384843 |
5 rows × 16 columns
.drop().assign().sort_values().rename()cereal_dropped = cereal.drop(columns = ['sugars','potass','vitamins', 'shelf', 'weight', 'cups'])
cereal_dropped.head(2)| name | mfr | type | calories | ... | sodium | fiber | carbo | rating | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | 100% Bran | N | Cold | 70 | ... | 130 | 10.0 | 5.0 | 68.402973 |
| 1 | 100% Natural Bran | Q | Cold | 120 | ... | 15 | 2.0 | 8.0 | 33.983679 |
2 rows × 10 columns
| name | mfr | type | calories | ... | shelf | weight | cups | rating | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | 100% Bran | N | Cold | 70 | ... | 3 | 1.0 | 0.33 | 68.402973 |
| 1 | 100% Natural Bran | Q | Cold | 120 | ... | 3 | 1.0 | 1.00 | 33.983679 |
2 rows × 16 columns