Histogramlar

Finans için Python’a Giriş

Adina Howe

Professor

Finansal analizde neden histogram?

histogram

Finans için Python’a Giriş

Histogramlar ve Veri

  • Veriniz çarpık mı?
  • Veriniz ortalama etrafında mı toplanıyor?
  • Anormal veri noktaları (aykırı değerler) var mı?
Finans için Python’a Giriş

Histogramlar ve matplotlib.pyplot

import matplotlib.pyplot as plt
plt.hist(x=prices, bins=3)
plt.show()

hist1

Finans için Python’a Giriş

Kutu (bin) sayısını değiştirme

import matplotlib.pyplot as plt
plt.hist(prices, bins=6)
plt.show()

hist2

Finans için Python’a Giriş

Histogram verisini normalize etme

import matplotlib.pyplot as plt
plt.hist(prices, bins=6, density=True)
plt.show()

normed

Finans için Python’a Giriş

Grafikte histogramları katmanlama

import matplotlib.pyplot as plt
plt.hist(x=prices, bins=6, density=True)
plt.hist(x=prices_new, bins=6, density=True)
plt.show()
Finans için Python’a Giriş

Histogram sonucu

iki_hist_normed

Finans için Python’a Giriş

Alfa: Histogramların saydamlığını değiştirme

import matplotlib.pyplot as plt
plt.hist(x=prices, bins=6, density=True, alpha=0.5)
plt.hist(x=prices_new, bins=6, density=True, alpha=0.5)
plt.show()
Finans için Python’a Giriş

Histogram sonucu

iki-hist-saydam

Finans için Python’a Giriş

Lejant ekleme

import matplotlib.pyplot as plt
plt.hist(x=prices, bins=6, density=True, alpha=0.5, label="Prices 1")
plt.hist(x=prices_new, bins=6, density=True, alpha=0.5, label="Prices New")
plt.legend()
plt.show()
Finans için Python’a Giriş

Histogram sonucu

şık hist

Finans için Python’a Giriş

Hadi pratik yapalım!

Finans için Python’a Giriş

Preparing Video For Download...