python 3.6 list(map())问题
伊谢尔伦
伊谢尔伦 2017-04-18 10:19:00
0
2
1005
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()来转换吗

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全員に返信(2)
伊谢尔伦

for ループを使用して反復します。
こんな感じ

いいねを押す +0
小葫芦

このマップは遅延評価であり、イテレータに似たものを返します。エラー メッセージを見ると、ラムダ式が実行されなかったため、ラムダ式に問題があることがわかります。あなたが渡したものは問題ありません。

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート