[Python] How to rename the columns inside nested column in pyspark

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

  1. Stack

    Stack Membro Participativo

    I have a column product inside which there is a nested column called Color. I want to remove the {} from the column color.

    I don't want to flatten the column and rename it. I directly want to rename the column or drop the column.

    |-- product: struct (nullable = true)
    | |-- {Color}: string (nullable = true)


    I have tried dropping it but it doesn't work. I don't want to create a new struct as I have many more nested columns and they are too much.

    |-- product: struct (nullable = true)
    | |-- {Color}: string (nullable = true)#

    Continue reading...

Compartilhe esta Página