[Python] List of tuples to Numpy recarray

Discussão em 'Python' iniciado por Stack, Junho 15, 2025.

  1. Stack

    Stack Membro Participativo

    Given a list of tuples, where each tuple represents a row in a table, e.g.

    tab = [('a',1),('b',2)]


    Is there an easy way to convert this to a record array? I tried

    np.recarray(tab,dtype=[('name',str),('value',int)])


    which doesn't seem to work.

    Continue reading...

Compartilhe esta Página