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 1

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

From the course: Python Data Analysis for Healthcare

Practical data manipulation and wrangling using pandas: Part 1

- [Instructor] Unclean data is common, and the confidence to wrangle data efficiently is one of the most important skills as a data analyst. In this exercise, we will improve the quality of a sample data set of medication names in classes using pandas. First, upload the provided 1000_Generic_Medication_Names data provided in your exercise files. Now, import pandas. Let's attempt to read the data with CSV. We have a ParserError, and from the founding we can see that this is a txt file. Let's inspect the data. So this is what the dataset looks like. This is truly medication name and the pharmacologic class they belong to. Let's attempt to load the data again, but this time around, let's specify a separator. So I have included the top separator. Okay. Using read_csv with the top separator, it works well. If you're paying attention to the first line, you will see that the first item on the row has been made the header. We don't want that. So let's fix it. We are going to fix this by…

Contents