2D split and stack
Splitting and stacking skills aren't just useful with 3D RGB arrays: they are excellent for subsetting and organizing data of any type and dimension!
You'll now take a quick trip down memory lane to reorganize the monthly_sales
array as a 3D array. Recall that the first dimension of monthly_sales
is rows of a single month's sales across three industries, and the second dimension is columns of monthly sales data for a single industry.
Your task is to split this data into quarterly sales data and stack the quarterly sales data so that the new third dimension represents the four 2D arrays of quarterly sales.numpy
is loaded as np
, and the monthly_sales
array is available.
Diese Übung ist Teil des Kurses
Introduction to NumPy
Interaktive Übung zum Anfassen
Probieren Sie diese Übung aus, indem Sie diesen Beispielcode ausführen.
# Split monthly_sales into quarterly data
q1_sales, q2_sales, q3_sales, q4_sales = ____
print(q1_sales)