Pengantar Python untuk Keuangan
Adina Howe
Instructor
Array NumPy tentang S&P 100: nama, harga, laba, sektor
Menjelajah dan menganalisis rasio P/E per sektor dalam perusahaan S&P 100
stock_prices = np.array([100, 200, 300])
filter_array = (stock_prices >= 150)
print(filter_array)
[ False True True]
stock_prices = np.array([100, 200, 300])
filter_array = (stock_prices >= 150)
print(stock_prices[filter_array])
[200 300]
Hitung rata-rata dan simpangan baku rasio P/E per sektor ini
import numpy as np
average_value = np.mean(my_array)
std_value = np.std(my_array)
Pengantar Python untuk Keuangan