课程: Hands-On Advanced Python: Data Engineering Basics
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Transforming data
- [Narrator] There are going to be times when a dataset isn't in the format that you'd like it to be in. And so you need to transform the data to better fit your needs. So one of the ways you can do this is by using the built-in map function. Let's open up our transforming data start code. And let me scroll up a little bit here. Alright, so the map function takes each value in a data set and maps it to a new value, and returns a new sequence of the transformed data. So in this example, we're going to use the map function to change our existing data from imperial units to metric units. And you can see here in my starting point code that I already have a few utility functions that convert imperial units, like temperature, and length, and speed into metric units. And so what I need to do is use the map function. And I'm going to scroll down a little bit here, and you can see I have a callback here called ToMetric. So my…