Conteúdo do Curso
Advanced Techniques in pandas
Advanced Techniques in pandas
Making Your Code Beautiful
Let's make our code more convenient and more readable. By the way, it is essential to make your code understandable for your coworkers.
To simplify the code, we can write the condition first and then put it into the .loc[]
function; look at the example from the previous chapter:
The first and second methods lead to the same output, but the second is much better for understanding because you can work with two conditions separately, and the statement within the .loc[]
function takes up less space.
Swipe to show code editor
Your task here is to consolidate knowledge from this chapter. You need to extract data on small asteroids with a high magnitude, or hazardous ones. To do so, follow the algorithm:
- Write the first condition: values from the column
'est_diameter_min'
are less than0.01
. Assign it to the variablecondition_1
. - Write the second condition: values from the column
'absolute_magnitude'
are greater than20
. Assign it to the variablecondition_2
. - Write the third condition: values from the column
'hazardous'
are equal toFalse
. Assign it to the variablecondition_3
. - Write the general condition that satisfies the requirement:
(condition_1 and condition_2) or condition_3
.
Obrigado pelo seu feedback!
Making Your Code Beautiful
Let's make our code more convenient and more readable. By the way, it is essential to make your code understandable for your coworkers.
To simplify the code, we can write the condition first and then put it into the .loc[]
function; look at the example from the previous chapter:
The first and second methods lead to the same output, but the second is much better for understanding because you can work with two conditions separately, and the statement within the .loc[]
function takes up less space.
Swipe to show code editor
Your task here is to consolidate knowledge from this chapter. You need to extract data on small asteroids with a high magnitude, or hazardous ones. To do so, follow the algorithm:
- Write the first condition: values from the column
'est_diameter_min'
are less than0.01
. Assign it to the variablecondition_1
. - Write the second condition: values from the column
'absolute_magnitude'
are greater than20
. Assign it to the variablecondition_2
. - Write the third condition: values from the column
'hazardous'
are equal toFalse
. Assign it to the variablecondition_3
. - Write the general condition that satisfies the requirement:
(condition_1 and condition_2) or condition_3
.
Obrigado pelo seu feedback!
Making Your Code Beautiful
Let's make our code more convenient and more readable. By the way, it is essential to make your code understandable for your coworkers.
To simplify the code, we can write the condition first and then put it into the .loc[]
function; look at the example from the previous chapter:
The first and second methods lead to the same output, but the second is much better for understanding because you can work with two conditions separately, and the statement within the .loc[]
function takes up less space.
Swipe to show code editor
Your task here is to consolidate knowledge from this chapter. You need to extract data on small asteroids with a high magnitude, or hazardous ones. To do so, follow the algorithm:
- Write the first condition: values from the column
'est_diameter_min'
are less than0.01
. Assign it to the variablecondition_1
. - Write the second condition: values from the column
'absolute_magnitude'
are greater than20
. Assign it to the variablecondition_2
. - Write the third condition: values from the column
'hazardous'
are equal toFalse
. Assign it to the variablecondition_3
. - Write the general condition that satisfies the requirement:
(condition_1 and condition_2) or condition_3
.
Obrigado pelo seu feedback!
Let's make our code more convenient and more readable. By the way, it is essential to make your code understandable for your coworkers.
To simplify the code, we can write the condition first and then put it into the .loc[]
function; look at the example from the previous chapter:
The first and second methods lead to the same output, but the second is much better for understanding because you can work with two conditions separately, and the statement within the .loc[]
function takes up less space.
Swipe to show code editor
Your task here is to consolidate knowledge from this chapter. You need to extract data on small asteroids with a high magnitude, or hazardous ones. To do so, follow the algorithm:
- Write the first condition: values from the column
'est_diameter_min'
are less than0.01
. Assign it to the variablecondition_1
. - Write the second condition: values from the column
'absolute_magnitude'
are greater than20
. Assign it to the variablecondition_2
. - Write the third condition: values from the column
'hazardous'
are equal toFalse
. Assign it to the variablecondition_3
. - Write the general condition that satisfies the requirement:
(condition_1 and condition_2) or condition_3
.