课程: Advanced Python: Working With Data

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Data transformation

2016款 奔驰S550奔驰S550e 17款 油电混合 两驱

课程: Advanced Python: Working With Data

Data transformation

百度   令人尊敬的是,张弥曼主动将炙手可热的研究领域交给年轻学者,自己转而投身少有人关注的新生代鲤科鱼化石研究。

- [Instructor] Data doesn't always come in the form that you would like it to. So you might find yourself in a situation where you need to transform the data from one format into another. Python provides a function that can help with this. It's called the map function. The map function creates an iterator that takes one or more sequences of values and produces a new sequence by applying a given function to each value in the original sequences. So let's try a couple of simple examples and I'm going to open up my transform.py file. All right, so let's imagine that I've got a couple of sample data sets here, right. So down here, if I scroll down I've got a couple of sequences, right. This one here is numbers, actually. Well, they're both numbers, okay. And so let's imagine that I wanted to convert each of the numbers in this nums sequence to the square of the original number that's in the list. All right. So I can easily…

内容