kristianolesenlarsen / sdseml_online_exercises

Online exercise classes for the course "Social Data Science: Econometrics and Machine Learning"
11 stars 39 forks source link

Feedback Ex12: #14 #491

Open kristianolesenlarsen opened 4 years ago

kristianolesenlarsen commented 4 years ago

@EsbenBL (please reply to this issue when you have read your feedback)

The warmup Missing.

The exercises This

for rooms, persons_in_room in room_people.iteritems(): # Loop through rooms and persons_in_rooms
    for idx_and_id in data[data.room == rooms].index: # Loop over persons in the room (their idx's are the same as their id's)
        data.loc[idx_and_id, 'person_other'] = [x for x in persons_in_room if x != idx_and_id][0] # Only keep the roommate

can be done in much more readable and much faster ways - have a look at the writeup.

Score: 1 sorry your feedback is a bit brief this time