@mngeow wrote:
Hi,
I’m trying to convert an LDIF file from my AD into a dataframe. I used the python-ldap to parse the LDIF file and I get the resulting nested dictionary:
[ ( u'cn=vpupkin,cn=people,ou=company,dc=company,dc=com', { u'c': ['UA'], u'cn': ['vpupkin'], u'employeetype': ['Indoor Front-end developer'], u'gidnumber': ['500'], u'givenname': ['Vasya'], u'homedirectory': ['/home/vpupkin'], u'host': ['example.com'], u'l': ['Kyiv'], u'labeleduri': ['skype://test'], u'loginshell': ['/bin/bash'], u'mail': ['vpupkin@company.com'], u'o': ['company'], u'objectclass': [ 'inetOrgPerson', 'posixAccount', 'top', 'shadowAccount', 'ldapPublicKey', 'extensibleObject'], u'sn': ['Pupkin'], u'sshpublickey': ['ssh-rsa key'], u'st': ['Trudova, 15'], u'telephonenumber': ['7777777777'], u'uid': ['vpupkin'], u'uidnumber': ['1222'], u'userpassword': ['{SHA}fEqNCco3Yq9h5ZUglD3CZJT4lBs=']}), ( u'cn=vpupkin,cn=people,ou=company,dc=company,dc=com', { u'c': ['UA'], u'cn': ['vpupkin'], u'employeetype': ['Indoor Front-end developer'], u'gidnumber': ['500'], u'givenname': ['Vasya'], u'homedirectory': ['/home/vpupkin'], u'host': ['example.com'], u'l': ['Kyiv'], u'labeleduri': ['skype://test'], u'loginshell': ['/bin/bash'], u'mail': ['vpupkin@company.com'], u'o': ['company'], u'objectclass': [ 'inetOrgPerson', 'posixAccount', 'top', 'shadowAccount', 'ldapPublicKey', 'extensibleObject'], u'sn': ['Pupkin'], u'sshpublickey': ['ssh-rsa key'], u'st': ['Trudova, 15'], u'telephonenumber': ['7777777777'], u'uid': ['vpupkin'], u'uidnumber': ['1222'], u'userpassword': ['{SHA}fEqNCco3Yq9h5ZUglD3CZJT4lBs=']})]
This nested dictionary contains the entries for only 2 accounts, so obviously in the actual LDIF file there will be many more entries. The “objectclass” key has 6 values, which means that I can’t directly map this to a dataframe.
Is there any method to collapse those 6 values into 1 and delete the rest so that I can convert this dictionary to a dataframe?
Thanks!
Posts: 1
Participants: 1