I have a Data frame as shown below
import pandas as pd
df = pd.DataFrame({
"name": ["john","peter","john","alex"],
"height": [6,5,4,4],
"shape": ["null","null","null","null"]
})
I want to apply this--- If name == john and height == 6 return shape = good else if height == 4 return shape = bad else change the shape to middle so the final Dataframe should look like this
df = ({
"name": ["john","peter","john","alex"],
"height": [6,5,4,4],
"shape": ["good","middle","bad","bad"]
})
The only library I want to use is 'Pandas' and I do NOT want to use 'lambda' or 'NumPy'. Thanks in advance for your time. I will upvote your answers.