博客
关于我
Python中的map函数
阅读量:341 次
发布时间:2019-03-03

本文共 433 字,大约阅读时间需要 1 分钟。

>>>def square(x) :            # 计算平方数...     return x ** 2... >>> map(square, [1,2,3,4,5])   # 计算列表各个元素的平方[1, 4, 9, 16, 25]>>> map(lambda x: x ** 2, [1, 2, 3, 4, 5])  # 使用 lambda 匿名函数[1, 4, 9, 16, 25] # 提供了两个列表,对相同位置的列表数据进行相加>>> map(lambda x, y: x + y, [1, 3, 5, 7, 9], [2, 4, 6, 8, 10])[3, 7, 11, 15, 19]

map(function, iterable, …)

用于操作数据处理中很常见

data['date'] = list(map(lambda x,y:str(x)+"."+str(y),data['regYear'],data['regMonth']))

转载地址:http://jysl.baihongyu.com/

你可能感兴趣的文章
Nginx的是什么?干什么用的?
查看>>
nginx看这一篇文章就够了
查看>>
Nginx知识详解(理论+实战更易懂)
查看>>
Nginx简单介绍
查看>>
Nginx系列6之-rewirte功能使用案例总结
查看>>
nginx线程模型理解
查看>>
Nginx虚拟主机配置
查看>>
Nginx访问控制_登陆权限的控制(http_auth_basic_module)
查看>>
nginx访问控制配置
查看>>
Nginx负载均衡和F5的区别---系统运维工作笔记001
查看>>
nginx负载均衡和反相代理的配置
查看>>
nginx负载均衡器处理session共享的几种方法(转)
查看>>
nginx负载均衡的5种策略
查看>>
nginx负载均衡的5种策略(转载)
查看>>
nginx负载均衡的五种算法
查看>>
Nginx负载均衡(upstream)
查看>>
nginx转发端口时与导致websocket不生效
查看>>
Nginx运维与实战(二)-Https配置
查看>>
Nginx部署_mysql代理_redis代理_phoenix代理_xxljob代理_websocket代理_Nacos代理_内网穿透代理_多系统转发---记录021_大数据工作笔记0181
查看>>
Nginx配置HTTPS服务
查看>>