美文网首页
python遍历列表

python遍历列表

作者: Winteeena | 来源:发表于2018-01-20 21:26 被阅读0次

    假设有pd.dataframe的表df:

    index column1
    1

    以及列表list()

    想根据df的索引往list里面填内容,比较优美的做法是:

    for index, word in enumerate(list(df.column[:,0])): 
        list[index] = function(word)
    

    也就是

    for A, B in enumerate(list(df)):
             A[x] = B[y]
    

    from 集智社区

    相关文章

      网友评论

          本文标题:python遍历列表

          本文链接:https://www.haomeiwen.com/subject/shfxaxtx.html