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

Exploring the predictive variables

It is always useful to get a better understanding of the population. Therefore, one can have a closer look at the predictive variables. Recall that you can select a column in a pandas DataFrame by indexing as follows:

basetable["variable"]

To count the number of occurrences of a certain value in a column, you can use the sum method:

sum(basetable["variable"]==value)

In this exercise you will find out whether there are more males than females in the population.

Bu egzersiz

Introduction to Predictive Analytics in Python

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

Egzersiz talimatları

  • Count and print the number of females.
  • Count and print the number of males.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Count and print the number of females.
print(____(____[____] == ____))

# Count and print the number of males.
print(____)
Kodu Düzenle ve Çalıştır