Attention please I want to use "Pandas" only. I do not want to use lambda or NumPy.
I have a Data frame as shown below
import pandas as pd
df = pd.DataFrame({
"first-name": ["john","peter","john","alex"],
"height-ft": [6,5,4,6],
"shape-type": ["null","null","null","null"]
})
I want to apply this
If first-name == john and height-ft == 6
return shape-type = good
else if height-ft == 4
return shape-type = bad
else
change the shape-type to middle
So the final Dataframe should look like this
df = ({
"first-name": ["john","peter","john","alex"],
"height-ft": [6,5,4,6],
"shape-type": ["good","middle","bad","middle"]
})