From the course: Python Data Analysis for Healthcare

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Practical data manipulation and wrangling using pandas: Part 2

Practical data manipulation and wrangling using pandas: Part 2 - Python Tutorial

From the course: Python Data Analysis for Healthcare

Practical data manipulation and wrangling using pandas: Part 2

- [Instructor] In the previous video, we started cleaning the medication class in named data set. So this seemed like a better path than what we did before. So now let's tackle the Med_class. This time around we are going to create another column called med_class_2, which is going to contain our new formula. So df_med, we are going to have column called combined that we are not going to need, and then med_class_2, which we care about. df_med, we assess the string value because we can only split strings not least. We split it by dash, we specify that only one of the dash, and then we say expand=True. df_med, we should have two new columns, and with a new logic, if we are paying attention, for example 996, which had just Alpha as the med class now has Alpha Blocker, which is what we want. 998, the index here, which had just Alpha as the med class now has Alpha-2 Blocker. And if we're looking at 999, it still has the same problem. This split is not exactly what we want. We want this…

Contents