BaşlayınÜcretsiz Başlayın

Creating a 2D array

Multi-dimensional arrays can be useful for several tasks. In finance, for example, a 2D array may be used to store the prices and earnings for various companies. Let's create this 2D array, stock_array, from a list of prices and earnings.

numpy is imported as np and the two lists prices and earnings are available in your workspace.

Bu egzersiz

Introduction to Python for Finance

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create a 2D array of prices and earnings
stock_array = np.array(____)
print(stock_array)

# Print the shape of stock_array
print(stock_array.____)

# Print the size of stock_array
print(stock_array.size)
Kodu Düzenle ve Çalıştır