Compare list of data, Create new list depending on Condition, Mathematica

时间:2015-12-14 18:07:17

标签: list wolfram-mathematica

I have a bis aount of climate Data. Measuered over two Years on different Stations every ten Minutes. Some Measuremts are Missing (Diffferent on each Station)

I want to pick the rows with the same date and time and put them into a new table to start comparing.

the tableorder is Date, Time, Value, Date2 ,Time2, Val2

   {{ 20120806, 600, 253,  20120805, 1350, 565}, 
    { 20120806, 610, 280,  20120805, 1400, 609},
    { 20120806, 620, 306,  20120806, 600, 282}, 
    { 20120806, 630, 333,  20120806, 610, 305}, 
    { 20120806, 640, 353,  20120806, 620, 334}, 
    { 20120806, 650, 380,  20120806, 630, 364}, 
    { 20120806, 700, 406,  20120806, 640, 386}, 
    { 20120806, 710, 426,  20120806, 650, 409}}

the Result should be a table with one date,time and the two Values.

thanks

2 个答案:

答案 0 :(得分:0)

立即行动

Select[mix, #[[2]] == #[[6]] && #[[3]] == #[[7]] &][[All, {1, 2, 3, 5,
6, 7, 8}]]

答案 1 :(得分:0)

setupWithViewPager

分成单独的列表:

list = {{20120806, 600, 253, 20120805, 1350, 565}, {20120806, 610, 
    280, 20120805, 1400, 609}, {20120806, 620, 306, 20120806, 600, 
    282}, {20120806, 630, 333, 20120806, 610, 305}, {20120806, 640, 
    353, 20120806, 620, 334}, {20120806, 650, 380, 20120806, 630, 
    364}, {20120806, 700, 406, 20120806, 640, 386}, {20120806, 710, 
    426, 20120806, 650, 409}};

从两个列表中提取所有日期/时间值

{alist, blist} = Transpose /@ Partition[Transpose[list], 3];

添加"缺失的功能"如果缺少提供的日期/时间,请到列表中:

alldates = 
  Union@Flatten[{list[[All, {1, 2}]], list[[All, {4, 5}]]}, 1];

enter image description here