This is python code for dataframe
from pandas import DataFrame
import pandas as pd
names = {'First_name': ['Hanah', 'Ria', 'Jay', 'Bholu', 'Sachin'],
'Status':['Hanah', 'Ria', 'Jay', 'Bholu', 'Sachin'],
"charge":[10,11,12,13,14]}
df = pd.DataFrame(names)
This is the lambda function for generating output
df['Status'] = df['First_name'].apply(lambda x: [df["charge"]] if x == 'Ria' else 'Not Found')
print(df)
The output generated is this:
df['Status'] = df['First_name'].apply(lambda x: [df["charge"]] if x == 'Ria' else 'Not Found')
print(df)
The output is
First_name Status charge
0 Hanah Not Found 10
1 Ria [[10, 11, 12, 13, 14]] 11
2 Jay Not Found 12
3 Bholu Not Found 13
4 Sachin Not Found 14
But I want to generate the output
First_name Status charge
0 Hanah Not Found 10
1 Ria 11 11
2 Jay Not Found 12
3 Bholu Not Found 13
4 Sachin Not Found 14
So as in second row it is Ria so I have to fetch the result of charge(column) in second row and put it in status(column)