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

Sorting trees

Sometimes it's easiest to understand data when it is sorted according to the value you are most interested in. Your new research task is to create an array containing the trunk diameters in the New York City tree census, sorted in order from smallest to largest.

numpy is loaded as np, and the tree_census 2D array is available.

Bu egzersiz

Introduction to NumPy

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

Egzersiz talimatları

  • Create an array called sorted_trunk_diameters which selects only the trunk diameter column from tree_census and sorts it so that the smallest trunk diameters are at the top of the array and the largest at the bottom.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Extract trunk diameters information and sort from smallest to largest
sorted_trunk_diameters = ____
print(sorted_trunk_diameters)
Kodu Düzenle ve Çalıştır