How can I output a groupby object to a csv file? My original input tsv file has the following format:
id     score    domain
1       5         x
2       3         x
1       4         y
2       2         y
I need the output tsv file to be grouped by id and sorted by score (descending order) so it will look like this:
id      score     domain
1        5          x
1        4          y
2        3          x
2        2          y
Any suggestions how should I do that? I tried some groupby and sort_values functions using pandas but it did not produce the required output for me. Thanks!
 
    