Submitted by Mogady t3_y7708w in MachineLearning
phb07jm t1_isudd5v wrote
Reply to comment by SkinnyJoshPeck in [D] How frustrating are the ML interviews these days!!! TOP 3% interview joke by Mogady
Can someone please explain why the second is preferable? I would always do the first because it's more likely that the position of a column will change than the name.
monkeyunited t1_isufl8u wrote
Yep, you’re right.
It’s not preferred.
silvershadow t1_isurezr wrote
Change the iloc to a loc and then I would maybe see the argument.
.iloc and .loc explicitly return the original data frame, while [] indexing can in some cases return a copy. Pandas makes no promises on what you get
So depending on what the full expression was the criticism of using [] inducing could make sense. You’d need to see the full context of what OP was writing though.
From the sounds of what they wrote though, this is not the thinking the interviewer was following.
Viewing a single comment thread. View all comments