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

Comparing two histograms

Histograms can also be used to compare the distributions of multiple datasets. In this exercise, you will compare the performance of two different stocks to find out which stock has the most fluctuation.

matplotlib.pyplot is imported as plt and lists stock_A and stock_B are available in your workspace.

Bu egzersiz

Introduction to Python for Finance

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

Egzersiz talimatları

  • Plot the histogram of stock_A with 100 bins and a transparency of 0.4.
  • Plot the histogram of stock_B with 100 bins and a transparency of 0.4.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Plot histogram of stocks_A
____(stock_A, bins=____, alpha=____)

# Plot histogram of stocks_B 
____(stock_B, bins=____, alpha=____)

# Display plot
plt.show()
Kodu Düzenle ve Çalıştır