Nov-23-2018, 12:59 PM
i have dictionary type, below is output when i read dataframe using json.loads (spark)
{'name':'ename','data':'str','len':'2','add':'bgl','out':'y','zip':'3567','add/blr':'Y'}
but i need output like below.
{'ename':{'data':'str','len':'2','add':'bgl','out':'y','zip':'3567','add/blr':'Y'}
the first element which is name not printed instead value of the name as( ename) should print as fieldkey and i have 20 rows in my file. for each row should print like this .. every row has different value for the name (key)
kindly suggest how can i achieve this through dictionary .
{'name':'ename','data':'str','len':'2','add':'bgl','out':'y','zip':'3567','add/blr':'Y'}
but i need output like below.
{'ename':{'data':'str','len':'2','add':'bgl','out':'y','zip':'3567','add/blr':'Y'}
the first element which is name not printed instead value of the name as( ename) should print as fieldkey and i have 20 rows in my file. for each row should print like this .. every row has different value for the name (key)
kindly suggest how can i achieve this through dictionary .