Tavuk konumlarını çizmek
Şimdi Nashville'deki tavukların nerede olduğunu gösteren bir saçılım grafiği oluşturacaksın!
Bu egzersiz, kursun bir parçasıdır
Python ile Coğrafi Verileri Görselleştirme
Egzersiz talimatları
- Tavuk veri kümesinin yolu
chickens_pathdeğişkeninde. pandas'ınread_csvfonksiyonunu kullanarak bunuchickensadlı bir DataFrame'e yükle. - İlk birkaç satıra bakmak için
.head()fonksiyonunu kullan. - Sonra Nashville'deki tavukların konumlarını çizmek için
plt.scatter()içine x ve y argümanlarını ekle. Varsayılan işaretçi ve renk seçeneklerini kullan. - Grafiği
plt.show()ile göster.
Uygulamalı etkileşimli egzersiz
Bu egzersizi bu örnek kodu tamamlayarak deneyin.
# Import pandas and matplotlib.pyplot using their customary aliases
import pandas as pd
import matplotlib.pyplot as plt
# Load the dataset
chickens = pd.____(chickens_path)
# Look at the first few rows of the chickens DataFrame
print(chickens.____())
# Plot the locations of all Nashville chicken permits
plt.scatter(x = chickens.____, y = chickens.____)
# Show the plot
plt.show()