0
$\begingroup$

I have a list like this:

rew={{{2011, 3, 13, 0, 0, 0}, 1044.4}, {{2011, 3, 13, 3, 0, 0}, Missing["NotAvailable"]}, 
{{2011, 3, 13, 3, 0, 0}, 1044.7}, {{2011, 3, 13, 6, 0, 0}, 1043.4}, 
{{2011, 3, 13, 9, 0, 0},1041.5}, {{2011, 3, 13, 12, 0, 0}, 1044.1}, 
{{2011, 3, 13, 15, 0, 0}, 1045.4}, {{2011, 3, 13, 18, 0, 0}, 1046.8}, 
{{2011, 3, 13, 21, 0, 0}, 1047.5},.....}

How do I delete duplicated sublists?

From this list I want to delete

 {{2011, 3, 13, 3, 0, 0}, Missing["NotAvailable"]}, {{2011, 3, 13, 3, 0, 0}, 1044.7}

this sublists which have duplicates because the first part is the same. And also delete duplicates if I face the duplicates

$\endgroup$
  • $\begingroup$ what is {2011, 3, 13, 0, 0, 0}, 1044.4} a duplicate of? $\endgroup$ – Pinguin Dirk Nov 28 '13 at 7:08
  • $\begingroup$ Oh sorry, duplication is: {{2011, 3, 13, 3, 0, 0}, Missing["NotAvailable"]}, {{2011, 3, 13, 3, 0, 0}, 1044.7} $\endgroup$ – user2987529 Nov 28 '13 at 7:23
  • $\begingroup$ so you want to delete both (all!) entries beginning with {2011, 3, 13, 3, 0, 0} (or rather keep one entry?)? Please confirm $\endgroup$ – Pinguin Dirk Nov 28 '13 at 7:34
  • $\begingroup$ Check if this does what you want: DeleteCases[GatherBy[rew, First@# &], datum_ /; Length[datum] != 1] $\endgroup$ – Aky Nov 28 '13 at 7:37
  • 1
    $\begingroup$ GatherBy[list, First][[;;, 1]] the second part of this question is yours question. $\endgroup$ – Kuba Nov 28 '13 at 8:16