Een nadere blik op de sectoren

Introductie tot Python voor Finance

Adina Howe

Instructor

Je missie

Gegeven

NumPy-arrays met gegevens over de S&P 100: namen, prijzen, winst, sectoren

Doel Deel II

Onderzoek en analyseer sectorspecifieke K/W-verhoudingen binnen bedrijven in de S&P 100

Introductie tot Python voor Finance

Stap 1: Maak een booleaanse filterarray

stock_prices = np.array([100, 200, 300])
filter_array = (stock_prices >= 150)
print(filter_array)
[ False True  True]
Introductie tot Python voor Finance

Stap 2: Pas de filterarray toe om een andere array te subselecteren

stock_prices = np.array([100, 200, 300])
filter_array = (stock_prices >= 150)
print(stock_prices[filter_array])
[200 300]
Introductie tot Python voor Finance

Stap 3: Vat K/W’s samen

Bereken het gemiddelde en de standaarddeviatie van deze sectorspecifieke K/W’s

import numpy as np
average_value = np.mean(my_array)
std_value = np.std(my_array)
Introductie tot Python voor Finance

Laten we oefenen!

Introductie tot Python voor Finance

Preparing Video For Download...