I have a data frame where 4th column contain ASCII values.
mydict=[('1385145553847005',
'54',
'NPAVIN',
'9175042231172',
'[89,111,117,114,32,78,80,65,86,32,79,110]',
'20131123000914',
'NA',
'NA',
'0',
'0',
'NA',
'undefined',
'a4d05539-cd61-43ee-a870-702e20caeaff',
'0',
'0',
'0'),
('1385145553847006',
'55',
'NPAVIN1',
'9175042231171',
'[78,80,65,86,32,79,110]',
'20131123000915',
'NA',
'NA',
'0',
'0',
'NA',
'undefined',
'a4d05539-cd61-43ee-a870-702e20caeaff',
'0',
'0',
'0')
]
import pandas as pd
df = pd.DataFrame(mydict)
I have written a function that needs to be applied to the 4th column.
def get_ascii(amyl):
mys=''
for item in amyl:
mys= mys+(chr(int(item)))
return mys
This does not work. I get value Error:
df.apply(get_ascii(df[4]))
Expected Result: The following 2 values should be added to the last column of the data-frame.
'Your NPAV On'
'NPAV On'