python 3.6 list(map())问题
问题描述
map(lambda x: [ret_ttest.loc[x][0], ret_ttest.loc[x][1]], ret_ttest.index)
结果:<map at 0x1e00aa38ef0>
list(map(lambda x: [ret_ttest.loc[x][0], ret_ttest.loc[x][1]], ret_ttest.index))
报错:---------------------------------------------------------------------------TypeError Traceback (most recent call last)<ipython-input-34-83f4c7c19c94> in <module>()----> 1 ret_ttest_df = list(map(lambda x: ret_ttest.loc[x, ret_ttest.locx], ret_ttest.index))
TypeError: ’list’ object is not callable
前几天升级了3.6,现在map对象不是在外面添加list()来转换吗
问题解答
回答1:用for 循环来迭代。这样的

这个map是惰性求值,返回的是类似一个迭代器的东西.看报错信息应该是你lambda表达式的问题,前一个不报错是因为没有执行.所以检查一下你传进去的lambda表达式是不是有问题.
相关文章:
1. macos - mac下docker如何设置代理2. 如何解决Centos下Docker服务启动无响应,且输入docker命令无响应?3. docker-machine添加一个已有的docker主机问题4. html5 - 请问一下写H5的时候 你们都是兼容那些手机5. docker api 开发的端口怎么获取?6. c# - mysql 查询优化 ?7. mysql - 仅仅只是把单引号与反斜杠转义不用prepare statement能否避免sql注入?8. dockerfile - [docker build image失败- npm install]9. javascript - Android 的 webview 中怎么监听 url 的 hash 变化10. java - 为什么第一个线程已经释放了锁,第二个线程却不行?

网公网安备