>  Q&A  >  본문

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()来转换吗

伊谢尔伦伊谢尔伦2740일 전925

모든 응답(2)나는 대답할 것이다

  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:21:00

    반복하려면 for 루프를 사용하세요.
    이렇게

    회신하다
    0
  • 高洛峰

    高洛峰2017-04-18 10:21:00

    이 맵은 지연 평가이며 반복자와 유사한 것을 반환합니다. 오류 메시지를 보면 람다 표현식에 문제가 있는 것 같습니다. 따라서 람다를 확인하세요. 전달하신 표현식입니다. 수식에 문제가 있나요?

    회신하다
    0
  • 취소회신하다