...

/

Fixing the Columns

Fixing the Columns

Learn the steps to fix the columns of a dataset.

Understanding the dataset's columns

As a first step when cleaning data, we retrieve the columns and apply standard data wrangling techniques. The goal is to ensure column names are easy to read and reference later during analysis.

Press + to interact
Python 3.8
Files

Let’s review the code line by line:

  • Line 1: We import the pandas library.

  • Line 2: We load the employees.csv dataset.

  • Line 3: We retrieve column names from a DataFrame using the columns property and print them using the print() function.

As we can see, the output comprises a list of the DataFrame column names. We can also see that the columns HEIGHT, WEIGHT, and ACCOUNT A have spaces as part of the column names. We'll remove these spaces in the next section.

Displaying the

...