Question:
def volume(df):I am working to calculate volume of a diamond dataset where dimensions x,y,z and depth are given and I have to calculate volume = xyz when depth >60 else volume is to be set to 8 but the code I have written is not assigning volume =8 when depth <60 and simply calculates volume = xyz , perhaps the code isn’t taking the else condtion initially is what i thought so I used a counter a which incremented by one when else block was executed and I printed its value successfully (my debug attempt) . Can you guys help me out in this ? Thanks in advance
Answer:
Instead of looping, try this code:If you have better answer, please add a comment about this, thank you!