ComeçarComece de graça

First look at censored data

You are the lead data scientist at the national government of a small country named Data Land. You are helping write the law on how long presidencies should last. Because your country relies on data for every decision, you seek wisdom from a DataFrame of 1808 regimes across 202 countries, called regime_durations. How long do regimes tend to last? The fate of your country lies between the rows and in your hands…

Your goal is to calculate the average duration. Because you are using a time-to-event dataset, you will need to inspect the data to check for censorship.

The pandas package is loaded as pd. The durations DataFrame is loaded and stored as regime_durations. You can use the console to view the DataFrame's column names.

Este exercício faz parte do curso

Survival Analysis in Python

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Print first row
print(regime_durations.____)

# Count censored data
count = len(regime_durations[regime_durations[____] == ____])

# Print the count to console
print(____)
Editar e executar o código