[Python] Convert an LDIF file to a tabular DataFrame with Python Polars

Discussão em 'Python' iniciado por Stack, Agosto 5, 2025.

  1. Stack

    Stack Membro Participativo

    I have several LDIF files that look like this:

    changetype: add
    objectClass: inetOrgPerson
    uid: jdoe
    cn: John Doe
    sn: Doe
    mail: jdoe@example.com

    dn: uid=asmith,ou=People,dc=example,dc=com
    changetype: add
    objectClass: inetOrgPerson
    uid: asmith
    cn: Alice Smith
    sn: Smith
    mail: asmith@example.com


    In R I would normally use the unnest() function to normalize the data in an LDIF file and convert it into tabular format:

    dn changetype objectClass uid cn sn mail
    uid=jdoe,ou=People,dc=example,dc=com add inetOrgPerson jdoe John Doe Doe jdoe@example.com
    uid=asmith,ou=People,dc=example,dc=com add inetOrgPerson asmith Alice Smith Smith asmith@example.com

    How do achieve this using Python Polars? Is there a way to do it

    Continue reading...

Compartilhe esta Página