quickest way to to convert list of tuples to a series

前端 未结 4 1586
误落风尘
误落风尘 2021-02-19 12:59

Consider a list of tuples lst

lst = [(\'a\', 10), (\'b\', 20)]

question
What is the quickest way to

4条回答
  •  名媛妹妹
    2021-02-19 13:37

    The simplest way is pass your list of tuples as a dictionary:

    >>> pd.Series(dict(lst))
    a   10
    b   20
    dtype: int64
    

提交回复
热议问题