python - How to split dictionary values using the another key's values(integer) -
i made dictionary. this;
output = {} output['epoch time'] = obstimes output['number of satellites'] = numsat output['ok flag'] = ok_flag output['prn'] = sats output['observation'] = result output['number of each data'] = i have split dictionary values using key's values. show example.
{...], 'observation': ['22527689.086 7', none, '-578290.975 7', '-410051.96348', '22527682.94948', '20593906.672 7', none, '-142315.266 7', '-103992.19948', '20593902.01648', '22312367.273 6', '22312363.496 9', '-573672.801 6', '-426591.952 9', '22312363.52047', '24649943.453 3', none, '-696710.409 3', '-499047.10745', '24649943.55545', '21574180.359 7', none, '-440212.809 7', '-323130.81248', '21574175.09448', '20159532.789 7', none, '35621.205 7', '26243.45049', '20159527.23449', '24435415.719 6', '24435413.602 9', '417737.346 6', '319304.620 9', '24435413.80147', '23108319.461 5', none, '344109.572 5', '249072.03046', '23108315.90646', '21789481.414 7', none, '326180.505 7', '238895.05548', '21789474.12548', '21975436.727 7', none, '277875.380 7', '205734.181 8', '21975443.121 8', '19981973.117 9', none, '-127270.254 9', '-94211.274 9', '19981980.414 9', '21682862.406 6', none, '242033.680 6', '179454.101 8', '21682869.020 8', '20647552.734 7', none, '-446216.926 7', '-329944.882 9', '20647562.945 9', '23174371.141 6', none, '-645644.090 6', '-481288.202 8', '23174379.656 8', '21946454.047 6', none, '420271.088 6', '311362.996 8', '21946462.590 8', '21922170.063 8', none, '-124733.763 8', '-92183.249 9', '21922177.883 9' ...],...} i'd split 'observation' values using list of values.
another list of values this;
'number of each data' = [[80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 75, 80, 80, 80, 65, 75, 75, 75, 70, 60, 50, 55, 55, 70, 65, 75, 75, 70, 65, 75, 75, 75, 65, 70, 70, 75, 75.....]] i want split observation values using each 'number of each data' values.
i wish output this;
...], 'observation' : [80 values][80 values][80 values]...} please or advice me.
you should iterate on 'number of each data' list:
output['observationmatrix'] = [] counter = 0 value in output['number of each data']: output['observationmatrix'].append(output['observation][counter:counter + value]) counter += value and in end, remove (if want to) output['observation'] dictionary
Comments
Post a Comment