Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Poor Data Presentation | Preprocessing Data: Part I
Data Manipulation using pandas
course content

Conteúdo do Curso

Data Manipulation using pandas

Data Manipulation using pandas

1. Preprocessing Data: Part I
2. Preprocessing Data: Part II
3. Grouping Data
4. Aggregating and Visualizing Data
5. Joining Data

Poor Data Presentation

One of the reasons that can cause types inconsistency may be poor data presentation. For instance, values of weight column may have also the measurment unit (like, 25kg, 14lb). In this case Python will understand these values as strings.

Let's see what is wrong with the values in the columns we considered to have wrong type.

We found the root of the problem. All the columns but 'totinch' use dots . as indicator for missing values, while values in the 'totinch' column use commas , as the decimal separator. This may happen due to data origin, for instance. This problem can be solved by replacing commas with dots, and converting to float type.

Note, if you try to convert existing values into numeric type, then the error ValueError will be raised.

Tudo estava claro?

Seção 1. Capítulo 3
We're sorry to hear that something went wrong. What happened?
some-alt