Skip to content

Homework 4 questions

Klementyna Kasraie edited this page Sep 27, 2017 · 2 revisions

Question 2

The strings are returned as u'string' instead of 'string'.

The 'u' indicates unicode encoding. This is not really a problem, but you can change the character encoding using the encode method (see https://stackoverflow.com/questions/599625/python-string-prints-as-ustring).

Question 5

Can you please provide me some pointers for the question? Does creating a pivot table do any help?

This type of problem seems to come up quite often in real-life applications! Luckily, it can be solved in a very straight-forward way, using just "groupby" and "apply" methods in pandas. What you have to figure out is: what do I group by? How to get Emails from the grouped part? And how to define the correct lambda function to apply? Hint: inside the "apply", I would use something like <delimeter>.join(<list of emails>).