MulaiMulai sekarang secara gratis

Elementwise operations on arrays

Arrays allow for efficient numerical manipulation of its elements. Let's explore element-wise mathematical operations by calculating price to earnings ratio using two arrays, prices_array and earnings_array from the previous exercise.

This price to earnings ratio, or PE ratio, is a financial indicator of the dollar amount an investor can expect to invest in a company in order to receive one dollar of that company’s earnings.

prices_array and earnings_array are available in your workspace.

Latihan ini adalah bagian dari kursus

Introduction to Python for Finance

Lihat Kursus

Petunjuk latihan

  • Import numpy as np.
  • Create pe_array by dividing prices_array by earnings_array.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Import numpy as np
____

# Create PE ratio array
pe_array = ____

# Print pe_array
print(____)
Edit dan Jalankan Kode