Search⌘ K

Exercise: Data Typing and Structuring

Explore data typing by cleaning and converting price fields from strings to floats, then learn data structuring by adding cumulative sum columns. This lesson guides you through preparing and enriching data for ETL transformations using pandas.

Data typing

Suppose we extracted a dataset that includes a field called Price that represents the price of a product in dollars. However, upon further inspection, we noticed that the column’s data type is a string instead of a float. Furthermore, the prices are formatted with a dollar sign and comma, such as '$1,000.00'.

We know the data should eventually be loaded into a database table with a column data type of float. Our task is to remove the dollar sign and commas from the Price column and then convert the data ...