Conditional Methods
Learn how to perform conditional operations in pandas.
We'll cover the following
If-else with pandas
We’re going to see one more piece of code that illustrates what we consider a shortcoming of pandas. If we wanted to keep the top five makes and use Top10
for the remainder of the top ten makes, with “Other” for the rest, there is no built-in pandas method to do that. We could use the following function in combination with .apply
:
Get hands-on with 1400+ tech skills courses.