[Python] Polars - How to add two series that contain lists as elements

Discussão em 'Python' iniciado por Stack, Outubro 2, 2024.

  1. Stack

    Stack Membro Participativo

    Trying to add, subtract, two Series that contains datatype List[i64]. The operation seems to be not supported.

    a = pl.Series("a",[[1,2],[2,3]])
    b = pl.Series("b",[[4,5],[6,7]])
    c = a+b


    this gives the error:

    PanicException: `add` operation not supported for dtype `list[i64]`


    I would expect a element-wise sum, like would happen with numpy array for example:

    c = [[5,7],[8,10]]


    What's the correct syntax to add two series of lists?

    Continue reading...

Compartilhe esta Página