II have a serie object containing 3 columns (name, code, value) which I get from the below function:
def get_fuzz(df, w):
s = df['Legal_Name'].apply(lambda y: fuzz.token_set_ratio(y, w))
idx = s.idxmax()
return {'name': df['Legal_Name'].iloc[idx], 'lei': df['LEI'].iloc[idx], 'val': s.max()}
df1['Name'].apply(lambda x: get_fuzz(df, x))
The Serie looks like this
output
0 {'name': 'MGR Farms LLC', 'lei': '984500486BBD...
1 {'name': 'RAVENOL NORGE AS', 'lei': '549300D2O...
2 {'name': 'VCC Live Group Zártkörűen Működő Rés...
I can assign the output to my dataframe with the code below.
df1.assign(search=df1['Name'].apply(lambda x: get_fuzz(df, x)))
The Dataframe that I get looks like this
ID Name search
0 1 Marshalll {'name': 'MGR Farms LLC', 'lei': '984500486BBD...
1 2 JP Morgan {'name': 'RAVENOL NORGE AS', 'lei': '549300D2O...
Question
How can I split this column into 3 columns?
Final output wanted
ID Name Name_bis LEI Value
0 1 Marshalll MGR Farms LLC 984500486BBD 57
1 2 Zion ZION INVESTMENT 549300D2O 100