I have a dataframe (called cep) with two indexes (Cloud and Mode) and data columns. It looks like this :
The data columns are fitted to a linear function and I'm extracting the residuals to the fit in this way :
import pandas as pd
from scipy.optimize import least_squares
args = [-1, 15] # initial guess for the fit
def residuals(args, x, y):
"""
Residual with respect to a linear function
args : list with 2 arguments
x : array
y : array
"""
return args[0] * x + args[1] - y
def residual_function(df):
"""
Returns the array of the residuals
"""
return least_squares(residuals, args, loss='soft_l1', f_scale=0.5, args=(df.logP1, df.W)).fun
cep.groupby(['Cloud', 'Mode']).apply(lambda grp : residual_function(grp))
This gives the expected result :
Now is my issue : I'd like to insert those residual values each in their respective row in the original dataframe to compare them with other columns.
I checked that the returned arrays are of the right length to be inserted but so far I have no idea how to proceed.
I tried to follow tutorials, but the difference with the textbook problem here is that the function I applied does not aggregate the data. Do you have some hints?
Small sample data here :
Mode;Cloud;W;logP1
F;LMC;14,525;0,4939
F;LMC;13,4954;0,7491
F;LMC;14,5421;0,4249
F;LMC;12,033;1,0215
F;LMC;14,3422;0,5655
F;LMC;13,937;0,6072
F;LMC;13,53;0,737
F;LMC;15,2106;0,2309
F;LMC;14,0813;0,5721
F;LMC;14,5128;0,41
F;LMC;14,1059;0,5469
F;LMC;15,6032;0,1014
F;LMC;13,1088;0,8562
F;LMC;12,3528;1,0513
F;LMC;13,1629;0,8416
F;LMC;14,3114;0,4867
F;LMC;14,4013;0,498
F;LMC;13,5057;0,7131
F;LMC;14,3626;0,464
F;LMC;14,5973;0,4111
F;LMC;13,9286;0,6059
F;LMC;15,066;0,2711
F;LMC;12,7364;0,9466
F;LMC;13,3753;0,7442
F;LMC;13,9748;0,5854
F;LMC;12,8836;0,8946
F;LMC;14,4912;0,4206
F;LMC;14,4131;0,4567
F;LMC;12,183;1,1382
F;LMC;14,5492;0,3686
F;LMC;14,1482;0,5339
F;LMC;13,7062;0,7116
F;LMC;13,0731;0,8682
F;LMC;11,5609;1,353
F;LMC;13,9453;0,5551
F;LMC;14,0072;0,6715
F;LMC;13,9838;0,6021
F;LMC;13,9974;0,5562
F;LMC;14,3898;0,5069
F;LMC;14,4497;0,4433
F;LMC;14,3524;0,5064
F;LMC;12,9604;0,9134
F;LMC;12,9757;0,8548
F;LMC;14,2783;0,4927
F;LMC;13,7148;0,6758
F;LMC;14,2348;0,5142
F;LMC;12,6793;0,9415
F;LMC;14,2241;0,5738
F;LMC;14,472;0,4554
F;LMC;15,1508;0,2076
F;LMC;12,5414;1,0159
F;LMC;14,2102;0,5334
F;LMC;15,6086;0,1116
F;LMC;13,2986;0,8381
F;LMC;13,0136;0,8864
F;LMC;13,9774;0,585
F;LMC;14,4256;0,533
F;LMC;14,3582;0,4578
F;LMC;14,3258;0,4859
F;LMC;14,6646;0,3757
F;LMC;12,733;0,9901
F;LMC;14,6296;0,3839
F;LMC;14,054;0,5766
F;LMC;14,3194;0,4884
F;LMC;12,6602;0,9715
F;LMC;13,5909;0,5675
F;LMC;13,9268;0,6196
F;LMC;12,5813;0,9935
F;LMC;13,0824;0,8591
F;LMC;13,5097;0,7375
F;LMC;13,1938;0,5053
F;LMC;14,7357;0,3253
F;LMC;14,0624;0,6009
F;LMC;14,1528;0,533
F;LMC;14,6709;0,4007
F;LMC;14,2378;0,4875
F;LMC;11,951;1,2004
F;LMC;14,4555;0,4777
F;LMC;14,4001;0,4404
F;LMC;13,7707;0,6311
F;LMC;14,578;0,4175
F;LMC;15,8662;0,0159
F;LMC;14,055;0,5687
F;LMC;13,6238;0,7307
F;LMC;15,2572;0,2171
F;LMC;13,4022;0,7723
F;LMC;14,2392;0,5256
F;LMC;14,2505;0,4977
F;LMC;14,7174;0,3614
F;LMC;14,487;0,418
F;LMC;14,9309;0,3086
F;LMC;13,8352;0,6334
F;LMC;14,5598;0,41
F;LMC;14,5614;0,422
F;LMC;14,1486;0,5149
F;LMC;14,0304;0,4945
F;LMC;13,5781;0,6801
F;LMC;14,79;0,3218
F;LMC;12,376;1,0908
F;LMC;15,3215;0,2176
F;LMC;14,7264;0,3845
F;LMC;14,6276;0,4057
F;LMC;14,1712;0,5313
F;LMC;14,4153;0,483
F;LMC;12,905;0,9356
F;LMC;14,442;0,4309
F;LMC;12,8702;0,9159
F;LMC;12,8963;0,5775
F;LMC;13,8304;0,6467
F;LMC;14,4665;0,4165
F;LMC;13,0756;0,5794
F;LMC;13,841;0,6593
F;LMC;14,0924;0,5671
F;LMC;13,7546;0,6778
F;LMC;14,2828;0,5181
F;LMC;14,2424;0,5082
F;LMC;14,659;0,3989
F;LMC;13,7528;0,6768
F;LMC;13,7743;0,6368
F;LMC;13,2894;0,791
F;LMC;14,7512;0,3187
F;LMC;14,5241;0,4452
F;LMC;14,301;0,5121
F;LMC;13,334;0,7945
F;LMC;13,5052;0,7012
F;LMC;14,3664;0,4549
F;LMC;14,8614;0,3278
F;LMC;13,8612;0,582
F;LMC;14,2668;0,5158
F;LMC;14,3937;0,4457
F;LMC;14,0226;0,582
F;LMC;14,387;0,5565
F;LMC;14,3198;0,4362
F;LMC;14,4404;0,4701
F;LMC;14,2774;0,4939
F;LMC;13,7678;0,6557
F;LMC;14,3212;0,4882
F;LMC;14,6453;0,3696
F;LMC;13,9064;0,6084
F;LMC;13,5167;0,7581
F;LMC;14,1692;0,5134
F;LMC;14,6714;0,4136
F;LMC;14,4332;0,4507
F;LMC;14,705;0,3631
F;LMC;13,6728;0,496
F;LMC;15,358;0,1651
F;LMC;13,7592;0,6278
F;LMC;14,0626;0,5754
F;LMC;13,1127;0,8692
F;LMC;14,2108;0,498
F;LMC;14,4519;0,4449
F;LMC;14,0041;0,5666
F;LMC;14,157;0,5392
F;LMC;14,254;0,5245
F;LMC;15,4844;0,1838
F;LMC;14,0845;0,5626
F;LMC;13,0861;0,838
F;LMC;13,3144;0,831
F;LMC;14,2535;0,4911
F;LMC;14,0256;0,5723
F;LMC;14,3246;0,4938
F;LMC;14,4412;0,4136
F;LMC;14,1043;0,518
F;LMC;14,7512;0,3772
F;LMC;14,3982;0,5039
F;LMC;14,2701;0,5042
F;LMC;13,9166;0,5941
F;LMC;13,0324;0,837
F;LMC;13,4839;0,6331
F;LMC;13,4491;0,7443
F;LMC;14,4702;0,458
F;LMC;14,4814;0,4595
F;LMC;14,3008;0,4575
F;LMC;14,922;0,3313
F;LMC;14,6542;0,4263
F;LMC;14,5007;0,4838
F;LMC;14,4335;0,4829
F;LMC;14,4737;0,4586
F;LMC;14,2537;0,5442
F;LMC;14,038;0,5473
F;LMC;14,1413;0,5523
F;LMC;14,669;0,3505
F;LMC;12,3572;1,1033
F;LMC;13,868;0,6416
F;LMC;13,4292;0,816
F;LMC;11,6771;1,3442
F;LMC;14,5086;0,4654
F;LMC;14,3588;0,4807
F;LMC;14,6915;0,3674
F;LMC;15,6488;0,0647
F;LMC;12,4187;0,9791
F;LMC;14,1555;0,5235
F;LMC;14,5765;0,4281
F;LMC;14,3579;0,4596
F;LMC;13,0932;0,7957
F;LMC;14,4552;0,4216
F;LMC;13,2221;0,8505
F;LMC;14,4465;0,4466
F;LMC;14,2439;0,5032
F;LMC;14,9606;0,6308
F;LMC;14,4774;0,4424
F;LMC;14,1875;0,5361
F;LMC;13,3982;0,7644
F;LMC;13,0973;0,8595
F;LMC;13,8264;0,6334
F;LMC;13,9296;0,6164
F;LMC;14,5778;0,4033
F;LMC;13,579;0,726
F;LMC;14,0054;0,5779
F;LMC;14,1219;0,5451
F;LMC;14,3512;0,4808
F;LMC;14,5058;0,4199
F;LMC;14,598;0,4201
F;LMC;14,9516;0,2498
F;LMC;13,9944;0,6075
F;LMC;13,9462;0,557
F;LMC;14,2576;0,5148
F;LMC;14,9814;0,2929
F;LMC;14,3851;0,4573
F;LMC;14,3474;0,4606
F;LMC;14,4929;0,3882
F;LMC;14,5201;0,4234
F;LMC;13,7677;0,6548
F;LMC;14,3146;0,4695
F;LMC;14,2846;0,507
F;LMC;14,0967;0,5525
F;LMC;14,7976;0,3546
F;LMC;13,7497;0,6362
F;LMC;14,4647;0,4363
F;LMC;14,1924;0,5293
F;LMC;14,588;0,4089
F;LMC;13,4896;0,7329
F;LMC;14,695;0,3737
F;LMC;14,2672;0,4857
F;LMC;14,0784;0,5848
F;LMC;13,879;0,5743
F;LMC;14,2214;0,4988
F;LMC;12,922;0,8487
F;LMC;14,189;0,5238
F;LMC;13,9938;0,5713
F;LMC;14,379;0,4771
F;LMC;11,2308;1,3564
F;LMC;14,4472;0,4205
F;LMC;14,3739;0,4699
F;LMC;14,393;0,4416
F;LMC;13,9108;0,5927
F;LMC;14,0298;0,6058
F;LMC;15,1538;0,1961
F;LMC;13,0393;0,8731
F;LMC;13,7144;0,645
F;LMC;14,2682;0,487
F;LMC;14,3506;0,4927
F;LMC;14,0472;0,5619
F;LMC;15,1418;0,2506
F;LMC;13,1227;0,5998
F;LMC;13,5646;0,7193
F;LMC;14,5872;0,4357
F;LMC;14,2636;0,5007
F;LMC;13,9564;0,5599
F;LMC;12,8576;0,946
F;LMC;12,3042;1,1454
F;LMC;11,8416;1,3675
F;LMC;13,5498;0,7219
F;LMC;12,1976;1,1581
F;LMC;13,8632;0,6202
F;LMC;14,2952;0,4807
F;LMC;14,4349;0,4437
F;LMC;14,2392;0,5445
F;LMC;13,7248;0,7213
F;LMC;14,3395;0,5117
F;LMC;15,3588;0,2253
F;LMC;12,8509;0,9229
F;LMC;15,5192;0,1453
F;LMC;14,2072;0,4975
F;LMC;14,3524;0,4945
F;LMC;14,5152;0,4488
F;LMC;14,5106;0,4558
F;LMC;14,5759;0,3786
F;LMC;11,196;1,2374
F;LMC;14,3736;0,4788
F;LMC;14,1726;0,528
F;LMC;11,7899;1,1995
F;LMC;12,1062;1,1823
F;LMC;13,7113;0,6714
F;LMC;14,3512;0,4815
F;LMC;13,1016;0,8181
F;LMC;14,4968;0,562
F;LMC;12,4557;1,0671
F;LMC;14,0573;0,551
F;LMC;14,5916;0,4066
F;LMC;14,3214;0,488
F;LMC;13,5498;0,4885
F;LMC;14,4679;0,4273
F;LMC;14,2426;0,4816
F;LMC;13,5759;0,7052
F;LMC;14,0081;0,5769
F;LMC;14,0828;0,5379
F;LMC;12,4168;0,7578
F;LMC;14,1624;0,5052
F;LMC;13,8029;0,6621
F;LMC;14,1944;0,5145
F;LMC;13,7944;0,6184
F;LMC;15,0234;0,3158
F;LMC;13,0961;0,8282
F;LMC;13,976;0,5889
F;LMC;14,3236;0,4847
F;LMC;14,2618;0,4691
F;LMC;13,4528;0,7349
F;LMC;14,2846;0,507
F;LMC;14,4115;0,446
F;LMC;14,2199;0,5336
F;LMC;14,456;0,4423
F;LMC;14,2938;0,488
F;LMC;14,4109;0,4606
F;LMC;14,2599;0,497
F;LMC;13,9034;0,6384
F;LMC;13,6126;0,7075
F;LMC;14,5036;0,4218
F;LMC;14,0065;0,5741
F;LMC;14,8622;0,3404
F;LMC;14,635;0,3683
F;LMC;14,222;0,5454
F;LMC;14,1501;0,5548
F;LMC;14,0822;0,5705
F;LMC;13,5036;0,7267
F;LMC;14,5528;0,4161
F;LMC;14,3332;0,4614
F;LMC;14,1511;0,5471
F;LMC;14,6113;0,3934
F;LMC;14,2998;0,5031
F;LMC;14,1807;0,5352
F;LMC;13,5114;0,7013
F;LMC;12,2096;1,1344
F;LMC;14,3799;0,4304
F;LMC;12,4526;1,1135
F;LMC;14,5042;0,447
F;LMC;13,4594;0,7336
F;LMC;13,2066;0,8423
F;LMC;14,3734;0,4711
F;LMC;13,945;0,5953
F;LMC;12,9938;0,8969
F;LMC;13,4993;0,7034
F;LMC;13,9466;0,5678
F;LMC;14,1772;0,5077
F;LMC;13,5566;0,6949
F;LMC;14,021;0,5811
F;LMC;14,0264;0,646
F;LMC;12,0242;1,1666
F;LMC;14,3106;0,5027
F;LMC;14,9838;0,3164
F;LMC;14,1718;0,5266
F;LMC;14,2606;0,489
F;LMC;12,6479;1,0206
F;LMC;12,9768;0,8684
F;LMC;14,0837;0,5785
F;LMC;13,7944;0,6609
F;LMC;13,532;0,6911
F;LMC;14,835;0,3375
F;LMC;13,7378;0,6941
F;LMC;14,3618;0,4658
F;LMC;12,4782;1,0176
F;LMC;14,2216;0,4981
F;LMC;14,3958;0,4917
F;LMC;11,3796;1,3161
F;LMC;13,8073;0,6301
F;LMC;14,414;0,4601
F;LMC;12,4266;1,086
F;LMC;14,7974;0,3547
F;LMC;14,3369;0,5189
F;LMC;14,3202;0,4874
F;LMC;14,4614;0,4664
F;LMC;13,8344;0,6339
F;LMC;14,0452;0,5896
F;LMC;11,9134;1,161
F;LMC;14,2492;0,4891
F;LMC;14,1338;0,5139
F;LMC;14,439;0,4476
F;LMC;14,1446;0,5322
F;LMC;14,102;0,549
F;LMC;14,5043;0,4421
F;LMC;14,388;0,4511
F;LMC;12,3812;1,0331
F;LMC;14,5086;0,4294
F;LMC;13,6822;0,671
F;LMC;12,3012;1,0862
F;LMC;14,0848;0,534
F;LMC;14,3381;0,4886
F;LMC;14,5544;0,3908
F;LMC;14,216;0,5226
F;LMC;14,5028;0,4323
F;LMC;12,7769;0,9244
F;LMC;13,6262;0,6984
F;LMC;14,5276;0,4107
F;LMC;13,921;0,5835
F;LMC;14,6279;0,396
F;LMC;14,6304;0,3796
F;LMC;14,2079;0,4722
F;LMC;12,4538;1,0356
F;LMC;14,2662;0,4876
F;LMC;13,8493;0,6217
F;LMC;12,9806;0,8385
F;LMC;14,3148;0,4768
F;LMC;14,2225;0,49
F;LMC;14,3932;0,4084
F;LMC;13,6934;0,5829
F;LMC;14,1702;0,5297
F;LMC;11,7812;1,2435
F;LMC;14,2866;0,4778
F;LMC;15,2824;0,1739
F;LMC;14,451;0,4485
F;LMC;14,4842;0,4222
F;LMC;14,3422;0,449
F;LMC;14,4408;0,4435
F;LMC;12,527;1,0298
F;LMC;12,3746;1,1016
F;LMC;11,4802;1,3276
F;LMC;14,47;0,4643
F;LMC;14,1469;0,5183
F;SMC;14,423;0,4796
F;SMC;15,5626;0,2344
F;SMC;15,6889;0,236
F;SMC;15,3574;0,2926
F;SMC;15,8049;0,1015
F;SMC;12,9034;0,9993
F;SMC;14,0039;0,6867
F;SMC;15,9834;0,1812
F;SMC;15,7707;0,2028
F;SMC;15,777;0,1735
F;SMC;14,7121;0,4973
F;SMC;13,8691;0,7188
F;SMC;14,889;0,4123
F;SMC;14,5322;0,6233
F;SMC;15,6791;0,331
F;SMC;13,9406;0,7262
F;SMC;13,728;0,8514
F;SMC;15,1952;0,3583
F;SMC;16,0921;0,1397
F;SMC;15,6162;0,1532
F;SMC;15,786;0,2563
F;SMC;16,0774;0,1197
F;SMC;14,4397;0,599
F;SMC;15,8693;0,2072
F;SMC;15,6668;0,2452
F;SMC;15,1954;0,3509
F;SMC;14,1387;0,669
F;SMC;15,6928;0,2125
F;SMC;14,6266;0,5017
F;SMC;15,9557;0,1772
F;SMC;15,607;0,2501
F;SMC;15,9632;0,1629
F;SMC;15,7932;0,2325
F;SMC;15,7108;0,1534
F;SMC;13,037;0,9898
F;SMC;15,3998;0,2915
F;SMC;15,1724;0,3675
F;SMC;13,7222;0,7848
F;SMC;14,8296;0,5222
F;SMC;15,704;0,2407
F;SMC;13,5231;0,8378
F;SMC;14,4338;0,5303
F;SMC;14,6202;0,4843
F;SMC;16,2836;0,0473
F;SMC;15,6011;0,1758
F;SMC;16,0037;0,1571
F;SMC;13,9062;0,6286
F;SMC;16,0606;0,0557
F;SMC;13,2924;0,8905
F;SMC;15,9942;0,1997
F;SMC;15,7766;0,2395
F;SMC;10,8462;1,6309
F;SMC;15,956;0,1425
F;SMC;13,857;0,7079
F;SMC;15,3619;0,2696
F;SMC;14,0064;0,6903
F;SMC;15,6531;0,2602
F;SMC;14,9001;0,5001
F;SMC;14,3957;0,6156
F;SMC;15,4414;0,3174
F;SMC;15,8321;0,1822
F;SMC;16,3562;0,1385
F;SMC;15,8812;0,1651
F;SMC;15,1404;0,408
F;SMC;13,7978;0,8055
F;SMC;15,9291;0,132
F;SMC;15,0555;0,507
F;SMC;15,5766;0,2596
F;SMC;13,6006;0,8469
F;SMC;16,455;0,0629
F;SMC;15,8762;0,1072
F;SMC;16,2856;0,0768
F;SMC;15,8521;0,2129
F;SMC;15,7685;0,2374
F;SMC;16,1197;0,1043
F;SMC;16,0851;0,2333
F;SMC;15,8126;0,1777
F;SMC;14,3891;0,6065
F;SMC;14,6419;0,5446
F;SMC;15,3942;0,3101
F;SMC;15,5785;0,2494
F;SMC;15,661;0,2227
F;SMC;15,9648;0,1405
F;SMC;12,7911;1,0845
F;SMC;15,9351;0,1575
F;SMC;14,1764;0,6864
F;SMC;15,153;0,3624
F;SMC;15,9336;0,1232
F;SMC;15,0124;0,3796
F;SMC;16,1231;0,106
F;SMC;14,4362;0,5306
F;SMC;13,1883;0,8354
F;SMC;15,8972;0,1757
F;SMC;14,1612;0,7287
F;SMC;15,3792;0,2869
F;SMC;16,421;0,0329
F;SMC;14,833;0,4543
F;SMC;14,3997;0,5912
F;SMC;15,8797;0,1747
F;SMC;16,0337;0,1565
F;SMC;15,7371;0,2251
F;SMC;13,954;0,7293
F;SMC;14,1691;0,6695
F;SMC;15,6208;0,2211
F;SMC;14,3416;0,6492
F;SMC;14,6636;0,5423
F;SMC;16,0386;0,1506
F;SMC;14,6578;0,5604
F;SMC;15,6368;0,24
F;SMC;14,843;0,4738
F;SMC;14,9818;0,4869
F;SMC;12,4251;1,1641
F;SMC;15,0727;0,4671
F;SMC;14,1448;0,5949
F;SMC;15,2148;0,3644
F;SMC;15,9372;0,117
F;SMC;15,4336;0,3018
F;SMC;14,5416;0,557
F;SMC;16,4654;0,0436
F;SMC;14,934;0,5498
F;SMC;14,3896;0,695
F;SMC;15,3896;0,3492
F;SMC;15,8122;0,1602
F;SMC;13,7822;0,704
F;SMC;15,7938;0,1679
F;SMC;15,4049;0,3059
F;SMC;16,0742;0,1187
F;SMC;15,704;0,2036
F;SMC;14,9947;0,3748
F;SMC;15,1374;0,4001
F;SMC;13,2254;0,7136
F;SMC;14,3267;0,577
F;SMC;12,7772;1,0317
F;SMC;15,5302;0,3074
F;SMC;16,12;0,1395
F;SMC;15,9826;0,1873
F;SMC;15,9196;0,2025
F;SMC;15,5396;0,2888
F;SMC;14,0063;0,7543
F;SMC;14,6752;0,542
F;SMC;14,3782;0,6365
F;SMC;15,8015;0,2321
F;SMC;15,4898;0,0235
F;SMC;15,6376;0,2499
F;SMC;15,527;0,2697
F;SMC;15,2883;0,3324
F;SMC;15,1014;0,3996
F;SMC;14,435;0,5827
F;SMC;16,1522;0,0832
F;SMC;13,3787;0,8974
F;SMC;16,6258;0,0226
F;SMC;14,0421;0,8043
F;SMC;15,4764;0,2719
F;SMC;14,1377;0,6069
F;SMC;15,3654;0,3461
F;SMC;16,3063;0,0677
F;SMC;15,5912;0,2227
F;SMC;14,555;0,5143
F;SMC;16,2947;0,0824
F;SMC;15,2208;0,3488
F;SMC;16,8052;-0,0287
F;SMC;15,8592;0,1835
F;SMC;15,6349;0,2632
F;SMC;16,522;0,0581
F;SMC;15,7794;0,3351
F;SMC;16,095;0,1574
F;SMC;16,0564;0,1818
F;SMC;16,4614;0,0897
F;SMC;16,1351;0,1332
F;SMC;14,4711;0,5808
F;SMC;13,8768;0,6795
F;SMC;16,2458;0,1273
F;SMC;16,1994;0,0372
F;SMC;15,3434;0,3072
F;SMC;15,5384;0,2442
F;SMC;14,5322;0,5703
F;SMC;15,7762;0,3507
F;SMC;14,3793;0,5628
F;SMC;15,4777;0,3139
F;SMC;15,9216;0,1764
F;SMC;14,3758;0,5278
F;SMC;15,2363;0,3313
F;SMC;14,3224;0,3258
F;SMC;15,2266;0,3656
F;SMC;15,6305;0,174
F;SMC;14,046;0,7832
F;SMC;14,8704;0,507
F;SMC;16,0267;0,2357
F;SMC;16,0671;0,154
F;SMC;13,8434;0,6901
F;SMC;14,4167;0,5992
F;SMC;15,9808;0,125
F;SMC;16,0696;0,1131
F;SMC;15,166;0,166
F;SMC;14,1023;0,6447
F;SMC;13,9666;0,6979
F;SMC;15,64;0,2577
F;SMC;15,6974;0,2429
F;SMC;15,1257;0,3877
F;SMC;15,186;0,3295
F;SMC;14,87;0,4651
F;SMC;16,0943;0,1807
F;SMC;15,7421;0,1809
F;SMC;14,6085;0,5253
F;SMC;14,6912;0,4777
F;SMC;14,1322;0,71
F;SMC;15,3319;0,2937
F;SMC;14,9283;0,4639
F;SMC;15,3753;0,2732
F;SMC;15,0886;0,3989
F;SMC;15,3778;0,3028
F;SMC;16,4933;0,0274
F;SMC;14,7944;0,4336
F;SMC;13,7806;0,7397
F;SMC;14,1895;0,6325
F;SMC;15,947;0,1084
F;SMC;15,9606;0,1665
F;SMC;15,417;0,0976
F;SMC;15,2905;0,3652
F;SMC;14,7712;0,4453
F;SMC;14,6692;0,5412
F;SMC;16,1936;0,0286
F;SMC;15,6136;0,2097
F;SMC;15,8061;0,078
F;SMC;15,3243;0,3385
F;SMC;15,2366;0,3669
F;SMC;16,1653;0,0573
F;SMC;15,916;0,1591
F;SMC;15,2422;0,3216
F;SMC;12,2583;1,2107
F;SMC;15,6361;0,1766
F;SMC;16,0818;0,1771
F;SMC;15,6966;0,2147
F;SMC;16,193;0,0657
F;SMC;14,8256;0,4574
F;SMC;15,7214;0,2185
F;SMC;15,5803;0,2725
F;SMC;14,7322;0,4754
F;SMC;15,8964;0,1898
F;SMC;14,5428;0,4732
F;SMC;16,1362;0,1396
F;SMC;16,2832;0,0473
F;SMC;15,6508;0,2232
F;SMC;14,725;0,4998
F;SMC;16,1585;0,1106
F;SMC;15,2284;0,3727
F;SMC;15,1728;0,3718
F;SMC;14,5354;0,5431
F;SMC;15,8224;0,1256
F;SMC;15,5462;0,2633
F;SMC;14,942;0,455
F;SMC;16,02;0,1426
F;SMC;15,2292;0,2965
F;SMC;14,6639;0,4402
F;SMC;14,887;0,4365
F;SMC;15,8288;0,1924
F;SMC;14,4903;0,5274
F;SMC;15,9464;0,1638
F;SMC;15,8069;0,1999
F;SMC;14,9924;0,3985
F;SMC;15,6917;0,1355
F;SMC;15,5414;0,1628
F;SMC;15,6168;0,2157
F;SMC;15,8006;0,177
F;SMC;14,9294;0,4732
F;SMC;14,5272;0,599
F;SMC;15,7318;0,2691
F;SMC;14,5181;0,5782
F;SMC;15,8524;0,2074
F;SMC;13,773;0,747
F;SMC;15,7608;0,1586
F;SMC;13,947;0,688
F;SMC;14,9774;0,4224
F;SMC;14,5288;0,4912
F;SMC;12,4944;1,2355
F;SMC;13,8683;0,6944
F;SMC;15,7118;0,186
F;SMC;15,7392;0,2081
F;SMC;12,292;1,1395
F;SMC;14,7918;0,4632
F;SMC;15,4428;0,3367
F;SMC;14,7542;0,4279
F;SMC;15,2914;0,3575
F;SMC;14,7332;0,4836
F;SMC;14,566;0,5553
F;SMC;15,9406;0,1167
F;SMC;15,6304;0,2296
F;SMC;14,0478;0,7063
F;SMC;15,5402;0,2821
F;SMC;15,6019;0,2443
F;SMC;15,6554;0,1979
F;SMC;14,7736;0,1631
F;SMC;16,1684;0,119
F;SMC;14,5113;0,5073
F;SMC;15,5466;0,134
F;SMC;15,1128;0,3919
F;SMC;13,4782;0,8109
F;SMC;15,8534;0,2208
F;SMC;13,1824;0,9072
F;SMC;15,8466;0,1901
1;LMC;13,9452;0,4076
1;LMC;14,3302;0,3149
1;LMC;12,9682;0,6984
1;LMC;15,0586;0,1023
1;LMC;14,328;0,304
1;LMC;15,024;0,0882
1;LMC;14,0594;0,3924
1;LMC;17,2026;-0,5304
1;LMC;14,327;0,3192
1;LMC;13,8748;0,4361
1;LMC;17,155;-0,4783
1;LMC;14,3154;0,3197
1;LMC;14,3376;0,2943
1;LMC;14,462;0,3461
1;LMC;14,139;0,3647
1;LMC;16,764;-0,4451
1;LMC;15,1618;0,1008
1;LMC;14,2229;0,3328
1;LMC;13,8046;0,4946
1;LMC;14,4268;0,2703
1;LMC;15,5032;-0,0368
1;LMC;15,9052;-0,1647
1;LMC;13,908;0,4434
1;LMC;14,3352;0,2986
1;LMC;13,6286;0,5326
1;LMC;13,7934;0,4842
1;LMC;14,3979;0,2817
1;LMC;14,0496;0,4238
1;LMC;14,4368;0,2939
1;LMC;14,3242;0,3164
1;LMC;12,6825;0,7719
1;LMC;13,846;0,4483
1;LMC;14,5746;0,2727
1;LMC;14,5171;0,2641
1;LMC;14,9218;0,1209
1;LMC;14,2248;0,3411
1;LMC;14,3478;0,3109
1;LMC;14,0999;0,357
1;LMC;14,5558;0,2632
1;LMC;13,7602;0,4936
1;LMC;14,5354;0,2775
1;LMC;13,5663;0,5364
1;LMC;17,0694;-0,4754
1;LMC;14,2915;0,3346
1;LMC;14,7311;0,218
1;LMC;13,6888;0,5417
1;LMC;14,627;0,2133
1;LMC;13,4404;0,597
1;LMC;14,7168;0,2212
1;LMC;15,0594;0,3161
1;LMC;15,0425;0,1061
1;LMC;16,815;-0,4438
1;LMC;16,001;-0,1914
1;LMC;14,4216;0,2488
1;LMC;14,4748;0,286
1;LMC;13,8631;0,466
1;LMC;14,676;0,2098
1;LMC;14,4089;0,3046
1;LMC;14,2384;0,3559
1;LMC;14,2154;0,3397
1;LMC;14,059;0,3829
1;LMC;14,7006;0,2089
1;LMC;13,2151;0,6923
1;LMC;14,5228;0,2442
1;LMC;14,1972;0,3233
1;LMC;14,7161;0,2052
1;LMC;14,4328;0,2944
1;LMC;14,4018;0,2906
1;LMC;14,7142;0,2083
1;LMC;14,5522;0,2311
1;LMC;13,6784;0,5121
1;LMC;14,396;0,31
1;LMC;14,5408;0,2582
1;LMC;13,9204;0,4699
1;LMC;14,3842;0,308
1;LMC;13,9161;0,4451
1;LMC;14,5161;0,2751
1;LMC;16,6794;-0,4003
1;LMC;14,2213;0,3356
1;LMC;14,0804;0,3867
1;LMC;14,3438;0,2957
1;LMC;16,7434;-0,4476
1;LMC;14,4333;0,2808
1;LMC;14,3312;0,2889
1;LMC;14,504;0,247
1;LMC;13,2101;0,6412
1;LMC;13,8247;0,4442
1;LMC;13,962;0,4153
1;LMC;14,0806;0,3598
1;LMC;14,4793;0,2675
1;LMC;14,8813;0,1499
1;LMC;14,5757;0,2212
1;LMC;14,409;0,2996
1;LMC;13,8864;0,4335
1;LMC;14,1462;0,3252
1;LMC;13,4634;0,5562
1;LMC;14,034;0,4077
1;LMC;17,5882;-0,6029
1;LMC;13,7698;0,4653
1;LMC;14,3287;0,3083
1;LMC;13,2086;0,6234
1;LMC;13,5732;0,546
1;LMC;15,48;-0,014
1;LMC;13,1248;0,6751
1;LMC;17,1166;-0,528
1;LMC;13,9133;0,4573
1;LMC;15,0072;0,1038
1;LMC;14,1087;0,3766
1;LMC;17,1206;-0,5551
1;LMC;14,6866;0,2054
1;LMC;13,4114;0,5868
1;LMC;15,8548;-0,1511
1;LMC;12,2802;0,6877
1;LMC;17,1984;-0,5196
1;LMC;13,2713;0,6421
1;LMC;14,537;0,2466
1;LMC;15,4264;0,0006
1;LMC;15,5466;-0,0351
1;LMC;14,5549;0,3135
1;LMC;14,8506;0,1502
1;LMC;15,1214;0,0971
1;LMC;14,0284;0,3934
1;LMC;13,0608;0,6455
1;LMC;14,4624;0,2676
1;LMC;15,2442;0,0527
1;LMC;13,9045;0,4276
1;LMC;14,0536;0,3947
1;LMC;14,0503;0,3833
1;LMC;14,2145;0,3506
1;LMC;14,3653;0,2799
1;LMC;12,2534;0,6564
1;LMC;13,4538;0,5395
1;LMC;16,7458;-0,3898
1;LMC;13,799;0,4515
1;LMC;14,3382;0,2787
1;LMC;13,6368;0,5072
1;LMC;13,4912;0,5308
1;LMC;14,8163;0,1739
1;LMC;13,8256;0,4412
1;LMC;14,3908;0,2858
1;LMC;14,9267;0,0972
1;LMC;14,5064;0,2072
1;LMC;13,899;0,4303
1;LMC;14,0764;0,3825
1;LMC;14,871;0,1848
1;LMC;14,8902;0,1544
1;LMC;14,1546;0,3697
1;LMC;14,7806;0,1531
1;LMC;15,3816;0,0162
1;LMC;14,1212;0,3378
1;LMC;14,6768;0,1847
1;LMC;14,229;0,3145
1;LMC;14,3439;0,2859
1;LMC;14,5225;0,183
1;LMC;14,222;0,3029
1;LMC;14,6786;0,2644
1;LMC;14,2882;0,3067
1;LMC;17,304;-0,4965
1;LMC;13,2234;0,6359
1;LMC;14,1998;0,341
1;LMC;16,9782;-0,4488
1;SMC;14,2801;0,5215
1;SMC;16,7184;-0,1413
1;SMC;15,6902;0,0745
1;SMC;16,1686;-0,057
1;SMC;14,6436;0,3746
1;SMC;16,573;-0,1489
1;SMC;15,4925;0,1575
1;SMC;15,0159;0,3255
1;SMC;15,5657;0,1226
1;SMC;14,3219;0,4484
1;SMC;16,5712;-0,1446
1;SMC;16,1988;-0,0829
1;SMC;15,4376;0,1613
1;SMC;13,6344;0,5874
1;SMC;14,3778;0,4716
1;SMC;14,2394;0,5057
1;SMC;15,8777;0,0206
1;SMC;16,7138;-0,1735
1;SMC;15,7367;0,0683
1;SMC;14,7922;0,3067
1;SMC;17,9934;-0,5486
1;SMC;14,1358;0,5249
1;SMC;14,8562;0,3176
1;SMC;15,5588;0,1312
1;SMC;14,3;0,5272
1;SMC;15,6038;0,0537
1;SMC;14,5812;0,4347
1;SMC;14,8804;0,3115
1;SMC;14,3614;0,4934
1;SMC;16,4298;-0,0449
1;SMC;15,8712;0,0365
1;SMC;14,3527;0,5141
1;SMC;15,639;0,0993
1;SMC;14,0709;0,4997
1;SMC;16,0837;0,0029
1;SMC;14,7445;0,4165
1;SMC;16,23;-0,0246
1;SMC;15,1252;0,2608
1;SMC;16,255;-0,043
1;SMC;15,4152;0,2079
1;SMC;15,6954;0,0998
1;SMC;14,8665;0,3692
1;SMC;15,7832;0,0378
1;SMC;14,8404;-0,2293
1;SMC;15,9228;0,0104
1;SMC;16,1484;0,0015
1;SMC;15,8728;0,0054
1;SMC;14,8986;0,2908
1;SMC;16,731;-0,2169
1;SMC;15,2766;0,1077
1;SMC;15,5933;0,0706
1;SMC;14,6399;0,3879
1;SMC;16,4613;-0,0989
1;SMC;15,1788;0,1832
1;SMC;16,2002;-0,0848
1;SMC;15,0008;0,2784
1;SMC;14,7586;0,2794
1;SMC;16,3034;-0,118
1;SMC;16,4006;-0,1251
1;SMC;15,849;-0,0155
1;SMC;16,3728;-0,0437
1;SMC;13,959;0,5954
1;SMC;15,9233;0,0135
1;SMC;15,1752;0,2438
1;SMC;14,8222;0,3179
1;SMC;16,0276;0,0558
1;SMC;15,2084;0,1235
1;SMC;16,3546;-0,1292
1;SMC;14,5508;0,4422
1;SMC;15,656;0,1128
1;SMC;15,2515;0,2473
1;SMC;15,8121;0,0231
1;SMC;15,6758;0,0838
1;SMC;16,729;-0,1389
1;SMC;16,2468;-0,126
1;SMC;13,9121;0,5834
1;SMC;14,368;0,4634
1;SMC;15,7206;0,0583
1;SMC;15,6693;0,0931
1;SMC;16,2687;-0,0599
1;SMC;15,0676;0,227
1;SMC;15,5143;0,1668
1;SMC;15,7076;0,0811
1;SMC;15,566;0,0386
1;SMC;16,1032;-0,0477
1;SMC;16,2852;-0,0936
1;SMC;13,9415;0,5344
1;SMC;13,7318;0,6038
1;SMC;14,6932;0,2731
1;SMC;17,5597;-0,4531
1;SMC;15,6816;0,0183
1;SMC;16,6984;-0,0744
1;SMC;15,0062;0,2869
1;SMC;15,8423;0,0837
1;SMC;15,6786;0,1166
1;SMC;14,6876;0,3651
1;SMC;15,5642;0,1374
1;SMC;16,8114;-0,1078
1;SMC;14,795;0,2782
1;SMC;14,2601;0,4012
1;SMC;16,4018;-0,1529
1;SMC;14,9727;0,2929
1;SMC;15,5267;0,1388
1;SMC;15,0455;0,2939
1;SMC;16,1594;-0,0279
1;SMC;15,6552;0,0574
1;SMC;14,4008;0,4278
1;SMC;16,1806;-0,0993
1;SMC;15,8383;0,0532
1;SMC;15,4704;0,1488
1;SMC;16,3872;-0,0714
1;SMC;14,7915;0,3349
1;SMC;13,9011;0,5528
1;SMC;16,5788;-0,1133
1;SMC;13,9728;0,5471
1;SMC;15,8312;0,048
1;SMC;15,696;0,0947
1;SMC;16,378;-0,0909
1;SMC;15,3721;0,1404
1;SMC;14,9808;0,2511
1;SMC;15,7881;0,0277
1;SMC;15,7657;0,0796
1;SMC;15,9406;0,0803
1;SMC;15,5712;0,1499
1;SMC;15,4664;0,1231
1;SMC;16,3175;-0,0522
1;SMC;15,4929;0,1124
1;SMC;13,5586;0,3835
1;SMC;16,205;-0,0705
1;SMC;15,55;0,08
1;SMC;17,5096;-0,2768
1;SMC;15,8832;0,0417
1;SMC;17,738;-0,542
1;SMC;14,5475;0,4257
1;SMC;15,4079;0,0751
1;SMC;16,2626;0,0103
1;SMC;14,5742;0,3754
1;SMC;16,521;-0,1554
1;SMC;16,791;-0,1832
1;SMC;15,4673;0,1727
1;SMC;14,2996;0,4629
1;SMC;13,6418;0,6525
1;SMC;15,7457;0,0729
1;SMC;15,4886;0,1447
1;SMC;14,7568;0,3357
1;SMC;15,482;0,1373
1;SMC;16,1634;-0,0447
1;SMC;15,7054;0,1234
1;SMC;14,5147;0,4154
1;SMC;15,0815;0,2683
1;SMC;15,992;-0,0153
1;SMC;14,3333;0,4373
1;SMC;15,3798;0,1507
1;SMC;15,957;-0,0025
1;SMC;15,889;0,0482
1;SMC;16,3458;-0,0707
1;SMC;15,565;0,17
1;SMC;15,0304;0,273
1;SMC;14,0869;0,4998
1;SMC;14,986;0,2767
1;SMC;16,144;-0,0551
1;SMC;15,5166;0,1347
1;SMC;14,3772;0,4966
1;SMC;15,8712;0,0196
1;SMC;14,6147;0,3938
1;SMC;16,7266;-0,1534
1;SMC;15,6266;0,1039
1;SMC;14,3126;0,4288
1;SMC;15,9238;-0,016
1;SMC;16,1556;-0,0916
1;SMC;14,6832;0,3555
1;SMC;14,9996;0,3125
1;SMC;14,8072;0,313
1;SMC;17,2238;-0,2249
1;SMC;14,2168;0,4893
1;SMC;16,0782;-0,0494
1;SMC;15,9124;0,0302
1;SMC;14,6897;0,3772
1;SMC;14,8998;0,317
1;SMC;14,3068;0,4708
1;SMC;14,9732;0,2529
1;SMC;16,1034;-0,0252
1;SMC;15,2416;0,2186
1;SMC;15,9578;-0,0056
1;SMC;14,605;0,3675
1;SMC;15,3892;0,1909
1;SMC;14,1306;0,5392
1;SMC;14,2198;0,4472
1;SMC;15,9806;0,1076
1;SMC;17,3222;-0,3888
1;SMC;14,8756;0,3077
1;SMC;16,4862;-0,1431
1;SMC;15,453;0,1643
1;SMC;15,719;0,105
1;SMC;15,0462;0,2544
1;SMC;14,3558;0,4541
1;SMC;13,7118;0,6472
1;SMC;14,9858;0,3054
1;SMC;14,7582;0,3293
1;SMC;15,8872;0,0343
1;SMC;14,2318;0,4783
1;SMC;15,7902;0,1023
1;SMC;15,7548;0,0084
1;SMC;16,3536;-0,1291
1;SMC;15,7356;0,0787
1;SMC;15,0988;0,2505
1;SMC;15,007;0,1926
1;SMC;15,0572;0,2629
1;SMC;15,4202;0,1177
1;SMC;14,5873;0,4062
1;SMC;14,274;0,472
1;SMC;15,953;0,032
1;SMC;15,1688;0,1666
1;SMC;15,4486;0,1694
1;SMC;16,2714;-0,084
1;SMC;14,1066;0,444
1;SMC;14,1883;0,4876
1;SMC;14,6876;0,3783
1;SMC;16,2804;-0,0307
1;SMC;16,004;0,0296
1;SMC;15,5427;0,0665
1;SMC;15,2691;0,1932
1;SMC;15,0723;0,2626
1;SMC;16,4086;-0,135
1;SMC;16,1279;-0,0629
1;SMC;14,6822;0,3247
1;SMC;16,1232;-0,1099
1;SMC;14,3967;0,4784
1;SMC;16,1678;-0,019
1;SMC;14,3868;0,4022
1;SMC;14,738;0,3264
1;SMC;15,8982;0,0036
1;SMC;16,0884;-0,0763
1;SMC;14,7889;0,3277
1;SMC;15,5037;0,1452
1;SMC;14,9974;0,3175
1;SMC;16,1114;-0,0793
1;SMC;15,5855;0,0736
1;SMC;15,1194;0,2507
1;SMC;15,1229;0,2498
1;SMC;15,5506;0,0998
1;SMC;15,8262;0,0085
1;SMC;17,6762;-0,4719
1;SMC;15,512;0,1091
1;SMC;15,1242;0,2304
1;SMC;14,8618;0,2606
1;SMC;15,8314;-0,0355
1;SMC;13,9661;0,5273
1;SMC;15,7528;0,0473
1;SMC;15,4834;0,1461
1;SMC;16,1654;0,0084
1;SMC;17,02;-0,0819
1;SMC;15,7764;0,0479
1;SMC;15,1877;0,2523
1;SMC;15,2879;0,1914
1;SMC;16,2964;-0,0454
1;SMC;15,5908;0,1223
1;SMC;15,6662;0,0394
1;SMC;15,5124;0,1418
1;SMC;14,876;0,2962
1;SMC;16,015;-0,0057
1;SMC;14,6491;0,4071
1;SMC;16,5376;-0,1862
1;SMC;16,4474;-0,1131
1;SMC;16,0558;0,0361
1;SMC;16,6338;-0,2435
1;SMC;18,2798;-0,5471
1;SMC;15,7256;0,0648
1;SMC;16,963;-0,2991
1;SMC;15,5069;0,1115
1;SMC;15,0298;0,1803
1;SMC;16,3346;-0,1174
1;SMC;14,794;0,3238
1;SMC;14,271;0,4877
1;SMC;15,9154;0,0438
1;SMC;16,5047;-0,1339
1;SMC;16,65;-0,1978
1;SMC;14,8017;0,3421
1;SMC;15,397;0,1778
1;SMC;16,8134;-0,2104
1;SMC;14,3519;0,421
1;SMC;14,6731;0,3168
1;SMC;15,2232;0,2349
1;SMC;14,6852;0,3608
1;SMC;14,9719;0,1979
1;SMC;15,1469;0,2306
1;SMC;15,2132;0,1439
1;SMC;14,788;0,3559
1;SMC;15,638;0,131
1;SMC;15,1227;0,1846
1;SMC;15,7846;-0,0333
1;SMC;16,1864;-0,0533
1;SMC;16,4067;-0,0201
1;SMC;16,7493;-0,236
1;SMC;16,5681;-0,2147
1;SMC;15,6974;0,0783
1;SMC;16,1395;-0,074
1;SMC;14,7655;0,3273
1;SMC;14,5638;0,3947
1;SMC;16,6594;-0,1952
1;SMC;16,1283;-0,0393
1;SMC;15,9034;0,0257
1;SMC;15,8515;0,0495
1;SMC;15,0717;0,3022
1;SMC;15,3598;0,1681
1;SMC;14,4274;0,4869
1;SMC;16,2396;-0,0553
1;SMC;16,082;-0,0294
1;SMC;14,8533;0,2512
1;SMC;14,6503;0,3586
1;SMC;16,1;-0,0353
1;SMC;15,6848;0,1708
1;SMC;15,9834;0,0201
1;SMC;14,3646;0,4274
1;SMC;15,285;0,1942
1;SMC;15,1247;0,2598
1;SMC;15,7448;0,0919
1;SMC;15,6758;0,1366
1;SMC;15,0902;0,226
1;SMC;14,0126;0,5439
1;SMC;15,9319;-0,082
1;SMC;15,0558;0,2398
1;SMC;14,5532;0,4375
1;SMC;14,8176;0,3557
1;SMC;15,1869;0,2378
1;SMC;14,5042;0,3989
1;SMC;14,7118;0,2721
1;SMC;14,5803;0,3939
1;SMC;15,4836;0,1186
1;SMC;15,2548;0,2071
1;SMC;15,5388;0,1499
1;SMC;15,507;0,1285
1;SMC;13,958;0,5414
1;SMC;16,4458;-0,0405
1;SMC;15,6919;0,0892
1;SMC;14,4196;0,4557
1;SMC;15,7577;0,03
1;SMC;16,382;-0,1317
1;SMC;14,456;0,4701
1;SMC;15,5165;0,0565
1;SMC;16,198;-0,0138
1;SMC;16,1511;-0,0355
1;SMC;14,3661;0,4568
1;SMC;15,088;0,2109
1;SMC;14,3802;0,4206
1;SMC;14,7786;0,2707
1;SMC;15,2855;0,3013
1;SMC;15,3114;0,1119
1;SMC;15,43;0,1134
1;SMC;16,1082;-0,0503
1;SMC;16,2348;-0,022
1;SMC;15,9953;-0,0417
1;SMC;15,2678;0,1952
1;SMC;15,1298;0,2325
1;SMC;15,1712;0,2456
1;SMC;15,5435;0,1342
1;SMC;15,8772;0,0307
A simple solution:
arrays=df.groupby(['Mode','Cloud']).apply(lambda grp : residual_function(grp))
residuals_value=[]
[residuals_value.extend(elem.tolist()) for elem in arrays]
df["residuals"]=residuals_value
I have a list of 1070 numbers (account balances) extracted from a source system, but due to technical issues, some of these values have the wrong sign (so I get for example 100 instead of -100)
I only have one information, once all the values have the correct sign, I will sum up to zero (but of course I have no idea how many figures have a wrong sign).
I tried to brute force a solution with the algorithm below, but it already takes forever when I am just combining 3 numbers (so reversing the sign of 3 numbers out of the 1070).
I believe that even if I optimize the my code, the number of combinations if I for example reverse 565 out of the 1070 elements is so large (5,740547E+319) that any brute force attemps will fail
I am basically trying trying to reverse one value in the list and then check if the sum is 0, then 2 values, 3 values and so on
It of course runs fine with only 6 numbers like below.
Does anybody has a suggestion of to approach that in a smarter way ?
import itertools
import numpy as np
test_list = np.array([1,2,3,4,5,9])
index_list = np.arange(0, len(test_list), dtype=np.intp)
sum_list = test_list.sum()
for L in range(1, len(test_list)+1):
print('current list lenght: ' + str(L))
for subset in itertools.combinations(index_list, L):
cur_list = np.array(test_list)
check = sum_list - (2 * cur_list[[subset]].sum())
if check == 0:
print('found:', subset)
This simple example has multiple solutions, the real values are more unique (and positive as well as negative), so I would not worry too much about having multiple solutions.
My list is the following (removed zero values):
[511720.02, 39409.62, 14680.43, 731.29, 10387.38, 2256.56, 262681.13, 5897.66, 11060.76, 144271.31, 25914.87, 13015.5, 19316.85, 40208606.69, -5846350.44, -33538929.18, -540682.74, 68089.94, 561696.88, 58050.78, 469706.4, 524.67, 472701.44, 2158456.56, 1158292.03, 100024.37, 18134.69, 337825.89, 10180.76, 2228315.58, 772.53, 8549.91, 43307.27, 39642.75, 72176.45, 323822.22, 962998.36, 135.5, 134388.73, 1473523.1, 275221.49, 34267.25, 549705.04, 247.87, 12958.72, 847714.28, 1781791.26, 3010.0, 1895276.98, 14434.11, 104587.1, 38056.23, 24962.62, 92497.96, 1227702.25, 110346.36, 391.85, 208.41, 8756.85, 782736.47, 3147519.19, 194767.75, 295568.31, 100694.2, 1893.93, 1133698.81, 523.2, 280280.91, 3078.82, 289841.77, 515.2, 175112.67, 24084.99, 35048.85, 49398.15, 41109.64, 1023.53, 782319.87, 28.14, 20.75, 13227.61, 14765.65, 41182.6, 4297.29, 1340.99, 826014.08, 6111.16, 965389.36, 673482.76, 109298.96, 39807.35, 311.79, 437149.28, 1950968.88, 325.21, 2764917.36, 8838.14, 202885.02, 25.49, 999.66, 743027.37, 759.22, 2950.0, 96146.21, 165.2, 21956.69, 1811289.92, 58.0, 6982282.03, 169464.71, 537268.28, 32655.3, 2474912.35, 1066214.61, 87962.0, 81526.67, 49053309.4, 45032405.02, 49548828.59, 48930853.47, 3533339.79, 3343489.4, 61758.14, 52772.61, 1095708.2, 819624.62, 141.17, 8611.75, 88752.23, 14669477.14, 22308370.28, 1215208.59, -183222.0, 99579.07, 621585.75, -26967.75, -787397.0, 18509117.59, 1212170.47, 60214.78, -749.37, 77455.94, 787350.1, 32760.21, 8117.1, 18493.03, 8267483.6, -15627.16, 58625.11, 38622.21, 57.11, 47565.71, 3523.6, 3205.0, 113242.59, 73.76, 782949.24, 5368.09, -4300.0, 2160047.12, -3533.08, 2460435.1, 50990.31, 93463.6, 1487.07, 22470.0, 22470.0, 999344.79, 135237.18, 9281.62, 3430281.72, 7126642.53, -53338.0, 9412.32, 3344946.88, 83075155.43, 17856133.2, 13449.34, 3845.0, 689998.56, 337645.3, 5937356.47, -2491.16, 2199069.77, 167652.42, 3331515.65, 1124710.59, 34075.85, 494639.09, 385540.84, 5891.39, 14378783.44, 7111253.62, 1247695.94, 1.0, 1.0, 138841.22, 0.5, 5979482.63, 1263134.4, 1.0, 5700.4, 12000000.0, 6100000.0, 1850000.0, 1000000.0, 500000.0, 51000.0, 77081.0, 19288853.74, 11600000.0, 4094000.0, 100000.0, 32400.0, 80000.0, 100000.0, 40810000.0, 33500000.0, 2336976.0, 812290.0, 177655.1, 1187432.01, 5224021.89, 4733986.5, 6174765.0, 1646604.82, 535146.3, 695690.19, 2858833.86, 863125.08, 859612.55, 631772.99, 100000.0, -200000.0, -177654.1, 10950.0, 25040.2, 1659670.0, 1143444.46, 3861357.87, 505930.63, 573072.0, 105000.0, 57500.0, -505929.63, -57499.0, 3402777.8, 54270.0, 105000.0, 44717.27, 1725619.5, 928972.0, 382924.78, 110015.09, 500.0, 100000.0, -1779887.33, -105000.0, -44717.27, -1311895.78, 19257544.9, 786109.73, 3885330.13, 9200000.0, 4347805.0, 464486.0, 13300000.0, 500000.0, 900000.0, 4000000.0, 550000.0, 46633144.87, 3657123.02, 2400000.0, 775000.0, 600000.0, 4980000.0, 715092.4, 250000.0, -715092.4, 5407573.99, 6516939.56, 71570143.67, -59186479.4, 1058557.22, -772031.22, 210000.0, 1753591.07, -1630557.07, 37550879.01, 2346460.63, -25169822.77, -1890843.63, 727919.84, -528559.84, 1073986.29, -556999.29, 5547811.48, -3130409.48, 8207549.38, 81942.17, 4489158.99, -7039209.16, -81942.17, -2143400.99, 89544215.17, -37091376.17, 1572011.0, -355928.0, 7478446.23, -595640.23, 32986206.95, -6325980.34, 13565577.0, -2178294.0, 32642339.14, -1005400.0, 3047129.66, 4586021.0, 67050.27, 60878226.61, -2654606.01, -2904000.0, 8393687.95, -18019508.06, -24442013.89, 1215208.59, 177570.85, -18047334.03, -1345725.77, 60214.78, -18212.52, -1823768.35, -354430.28, -8385048.47, 74505.96, -113659.2, 663309.32, -7694.18, -14335.0, 2160047.12, 4953.83, -228189.6, -100945.64, -8846.8, -2000000.0, -1102232.0, 205.2, 700000.0, 1550000.0, 500000.0, -29170503.05, -9741127.06, 2489697.93, -13599529.61, -8942775.78, -32726828.34, -14763682.06, -627846.99, -2340642.03, -4760527.23, -23148108.83, -33891335.24, -24840602.25, -39314900.39, -22877589.68, -2846969.98, -581650.3, -1269764.39, -665159.0, -2846969.98, -418.13, -4545969.04, -2281584.61, -15697827.3, -14778873.52, -18421816.45, -6420171.98, -781896.2, -1038820.41, -80650.97, -142900.19, -614263.27, -15871.81, -3386450.0, 3301075.71, -4058.89, -10407668.35, -8988470.62, -2236.0, -60178.92, -6202.25, -200000.0, -91700.3, -303039.14, -18543.12, -25149.83, -51468.44, -10100.0, -11755.05, -254974.16, -121982.45, -434.1, -853763.93, -100.08, 233961.15, 3521.99, -3776.15, -46650.33, -11412.02, -7970.43, -9798.65, -3942496.09, -1196495.36, -246462.91, -178049.1, -0.01, -18351592.93, -6551763.1, -5598.84, -264535.23, -425063.65, -48942.22, -6434834.64, -684003.27, -7617.96, -543416.91, -596612.84, -2896846.65, -203847.0, 5389.94, -37406548.94, -2609.35, -3543154.17, -83500.0, -1685476.4, -261289.34, -3342018.62, -4850000.0, 1500000.0, 4125000.0, -0.04, -89352.19, -178114.13, -54520.6, -15193100.0, -30960000.0, -3900000.0, -1000000.0, -10000000.0, -8361980.61, -8516941.31, -25000000.0, -5000000.0, -5000000.0, -8170843.24, -472127.77, -25000000.0, -1615441.58, -5697557.72, -18000.0, -810000.0, -362623.0, -526089.98, -8300000.0, -220000.0, 7.62, 15542.39, -25800625.31, -33795061.06, -20780610.38, -4665030.75, -39482892.35, -6840474.74, -18446631.31, -10152810.85, 2216320.89, -83747.0, -403572.0, 21763733.0, -3865209.08, -42267747.62, -263520555.75, 195087.06, -542668069.06, -54499963.22, -46824.57, -80703953.44, -34388289.6, -1120605.64, -1029611.15, -542066.51, -154157.05, -7932466.7, -13257498.78, -11093844.91, -2844716.35, -1361609.65, -5349483.43, -1439399.68, -2694.5, -1181.62, -418050.47, -400674.41, -246043195.73, -44799841.1, -326603330.98, -63937178.0, -37506337.11, -15076181.32, -488966.6, -230800995.11, -10509.4, -7575.0, -106584.18, -36375883.12, -45115231.08, -4305941.08, -9238.75, -516324.15, -10065.15, -2316745.72, -643656.45, -53267.0, -298191.95, -3537748.57, -399554.25, -13437.34, -2112.0, -93177.32, -306454.74, 24222.0, -12000.0, 14364.81, 19851.3, 39903.56, 12000.0, 175747.84, -353732.71, 926.66, -1311895.78, 1365487.35, 623561637.34, 1103900.52, 74.0, 36243106.75, 400408.55, 31379746.27, 1152340.15, 277020.97, 351518.86, 24432.73, 370113.15, 57822.7, 14334602.55, 5085111.06, 141482.62, 2960.2, 17357.8, 933574.99, 116678.06, 7191271.0, 1686605.85, 867515.1, -113006.87, 29156.65, 143305.39, 38947.38, 2992693.68, -504.46, -40954.64, 114478.4, 194370206.88, 24548647.12, 745995.52, 603106175.89, 15577814.31, 38526313.97, 43750465.62, 3.1, 35806829.4, 26656590.6, 1957311.8, 8649.7, 7575.15, 5230.3, 10083.33, 1076.43, 1047611.42, 172125.45, 3686.0, 134997.45, 8605.48, 677961.04, 82822.75, 133569.18, 1961196.0, 91776.21, 245448.12, 821.0, 1341.74, 137930.46, -8990.0, -26766176.74, 424769.32, 142428.86, -18789.13, 268399.38, 50263.7, -85550.06, 125538.91, 6263.29, 19500.75, 245829.52, -1365487.35, 40307915.86, 295222.37, -96036.81, 3166665.78, 1932755.66, 40400.0, -525840.25, 266808.43, 199000.0, -3737.2, 492669.16, -1969978.35, 1708500.83, 2748188.97, 643513.78, 2964400.04, 642333.18, 341338.4, 15289.73, 380235.94, 310.13, 108315.14, 638.16, 11507.44, 48799.64, -382413.8, 406563.18, 11080.63, 129207.66, 32419.8, 465.23, 53502.74, 263531.85, 370042.5, 123341.62, -9786.44, -124800.25, 71673.89, 3318959.25, 597466.94, 182928.82, 28019.14, 319467.85, 1563.75, 1660609.86, -1651940.0, 2806793.29, 84600.0, 27733.67, 714.71, 31198.43, 224970.45, 10020.87, 68734.49, 103156.32, 246821.22, 19097.3, 256539.34, 144102.4, 12122.3, 2604333.41, 191148.48, 94008.23, 6807.85, 2723.89, 5438.84, 122772.35, 156237.16, 24024.39, 705426.92, 187992.86, 132421.04, 241566.49, 102682.38, 41216.24, 4088.52, 1070878.31, 409464.57, 170804.67, 187236.66, 1298978.37, 42352.12, 1483572.01, 2083796.08, 9745.32, 15594.62, 58735.3, 83374.68, 20845.17, 739655.98, 45957.1, 24405.0, 111086.39, 150567.3, 23445.92, 2990.48, 8795.7, 26405.51, 459362.72, 51837.97, 144697.12, 4458.01, 300.0, 29541.52, 1954234.69, 66521.56, 40637.54, 29210.19, 11358.95, 38928.39, 95187.44, 113840.33, 66843.61, 34180.65, 19445.79, 52893.81, 138057.3, 205782.91, 98563.65, 111475.3, 197494.77, 6158.15, 1601.86, 116963.83, -1182305.05, 233113.73, -401948.82, 129.03, 497791.24, 6686.47, 131146.21, 26251.23, 368095.15, 25589.06, 39885.15, 882466.81, 193038.84, 293224.67, 123307.79, -35000.0, 3231.0, -5653952.45, 5469195.26, 243.15, 32610.33, 11495.93, 689585.9, 745.95, 221338.04, 83678.41, 52225.97, 14265.34, 4517.46, 2348.95, 98884.76, 1929.14, 8676.78, 126999.52, 48450.0, 23018.67, 642.63, 11311.66, 86076.58, 59632.21, 1200.0, 244068.03, 738908.91, 1111.06, 53129.02, 18323.65, 254206.26, 16409.53, 22472.94, 49361.21, 796671.0, 2618127.73, 158343.65, 5502.42, -21168.21, -33261.68, -3124673.81, -52827.56, -75.82, -71499.0, -185842.54, 776135.12, -56041.39, -151492.94, 146416.64, -363807.65, -1041536159.36, 1042111293.86, -343423458.56, 343105397.4, -8215190.59, 8189738.0, 10790777.98, 88377.0, 3968265.59, 1089147.0, 177964.0, 203973.0, 249376.0, 1107136.21, -1302612.04, -20665748.07, -268427.98, -1032648.0, -255228.63, -627322.81, -2680023.09, -2759982.21, -1260600.0, 121498.6, 64347.8, 76153.8, -146127.65, -317598.55, -147069.85, 245057.06, -245058.0, -85600.0, -728220.16, -121788.4, 41998.97, -236262.33, 330582.33, 225235.91, -86822.99, 3280734.73, 1734714.87, 14327.0, 6795.0, 49137.0, 334939.46, -375322.2, 2108892.54, 205427.44]
I can think of many ways I might try to solve this problem, but the bottom line is you'll never know what side of the equation is supposed to be negative.
+9-6-3 = 0
But this also applies to
-9+6+3 = 0
In other words: Even if you manage to sort out both sides of the equation, you'll always be left with two equally possible outcomes.
I need help with placing a marker on a plot where I have a single array to plot it.
I am receiving the data in ASCII format from one Instrument and I need to show the maximum from the data.
data1 = ['+3.613512E+003', '+3.254965E+003', '+2.938281E+003', '+2.678804E+003', '+2.461425E+003', '+2.282802E+003', '+2.128352E+003', '+2.001264E+003', '+1.883186E+003', '+1.774222E+003', '+1.681822E+003', '+1.601852E+003', '+1.524412E+003', '+1.458368E+003', '+1.394319E+003', '+1.338477E+003', '+1.282567E+003', '+1.206847E+003', '+1.305292E+003', '+1.175656E+003', '+1.082040E+003', '+1.050308E+003', '+1.033320E+003', '+9.772695E+002', '+9.437070E+002', '+1.039622E+003', '+8.937933E+002', '+8.677546E+002', '+8.302201E+002', '+8.098771E+002', '+7.839208E+002', '+7.641392E+002', '+7.450735E+002', '+7.270004E+002', '+7.100223E+002', '+6.938470E+002', '+6.777757E+002', '+6.627379E+002', '+6.484218E+002', '+6.346696E+002', '+6.215515E+002', '+6.091346E+002', '+5.969252E+002', '+5.858983E+002', '+5.738594E+002', '+5.632513E+002', '+5.531273E+002', '+5.434016E+002', '+5.338579E+002', '+5.245516E+002', '+5.156342E+002', '+5.069659E+002', '+4.985686E+002', '+4.904806E+002', '+4.827541E+002', '+4.751310E+002', '+4.678062E+002', '+4.606243E+002', '+4.540762E+002', '+4.473115E+002', '+4.408354E+002', '+4.345136E+002', '+4.282921E+002', '+4.223657E+002', '+4.166439E+002', '+4.109633E+002', '+4.052994E+002', '+4.001460E+002', '+3.950479E+002', '+3.895703E+002', '+3.846584E+002', '+3.799026E+002', '+3.751604E+002', '+3.705536E+002', '+3.660702E+002', '+3.616293E+002', '+3.573076E+002', '+3.532868E+002', '+3.491588E+002', '+3.450848E+002', '+3.411576E+002', '+3.377792E+002', '+3.338940E+002', '+3.302851E+002', '+3.267181E+002', '+3.232689E+002', '+3.197983E+002', '+3.162835E+002', '+3.130360E+002', '+3.098477E+002', '+3.066972E+002', '+3.036430E+002', '+3.005474E+002', '+3.017997E+002', '+2.970689E+002', '+2.943995E+002', '+2.906300E+002', '+2.872129E+002', '+2.844009E+002', '+2.817743E+002', '+2.791834E+002', '+2.766238E+002', '+2.741659E+002', '+2.715812E+002', '+2.691083E+002', '+2.667481E+002', '+2.643162E+002', '+2.620564E+002', '+2.597600E+002', '+2.575768E+002', '+2.553911E+002', '+2.532829E+002', '+2.512116E+002', '+2.491187E+002', '+2.471341E+002', '+2.451769E+002', '+2.431930E+002', '+2.412911E+002', '+2.394064E+002', '+2.375465E+002', '+2.357066E+002', '+2.338903E+002', '+2.321306E+002', '+2.304057E+002', '+2.286812E+002', '+2.269622E+002', '+2.252647E+002', '+2.236192E+002', '+2.220235E+002', '+2.204091E+002', '+2.187952E+002', '+2.172741E+002', '+2.157154E+002', '+2.142141E+002', '+2.127425E+002', '+2.112572E+002', '+2.098584E+002', '+2.084018E+002', '+2.069778E+002', '+2.055735E+002', '+2.042013E+002', '+2.028710E+002', '+2.015256E+002', '+2.001832E+002', '+1.988509E+002', '+1.976151E+002', '+1.962977E+002', '+1.950415E+002', '+1.937939E+002', '+1.925864E+002', '+1.913902E+002', '+1.901835E+002', '+1.890085E+002', '+1.878839E+002', '+1.866942E+002', '+1.855853E+002', '+1.844479E+002', '+1.833570E+002', '+1.822493E+002', '+1.812235E+002', '+1.801365E+002', '+1.790499E+002', '+1.780047E+002', '+1.769968E+002', '+1.759927E+002', '+1.750180E+002', '+1.740273E+002', '+1.730415E+002', '+1.720515E+002', '+1.711011E+002', '+1.701719E+002', '+1.691869E+002', '+1.682416E+002', '+1.673085E+002', '+1.664250E+002', '+1.655093E+002', '+1.646449E+002', '+1.637369E+002', '+1.628466E+002', '+1.619780E+002', '+1.611095E+002', '+1.602561E+002', '+1.594323E+002', '+1.585906E+002', '+1.577531E+002', '+1.569217E+002', '+1.561373E+002', '+1.553389E+002', '+1.544064E+002', '+1.536059E+002', '+1.528021E+002', '+1.520318E+002', '+1.512934E+002', '+1.505179E+002', '+1.497283E+002', '+1.489904E+002', '+1.482520E+002', '+1.475254E+002', '+1.467694E+002', '+1.460747E+002', '+1.453611E+002', '+1.446382E+002', '+1.439315E+002', '+1.432143E+002', '+1.425103E+002', '+1.417149E+002', '+1.410070E+002', '+1.402541E+002', '+1.395410E+002', '+1.388785E+002', '+1.381431E+002', '+1.373078E+002', '+1.684952E+002', '+1.735877E+002', '+1.736905E+002', '+1.724396E+002', '+1.723501E+002', '+1.712648E+002', '+1.702213E+002', '+1.694995E+002', '+1.641237E+002', '+1.672958E+002', '+1.667476E+002', '+1.663030E+002', '+1.641203E+002', '+1.632126E+002', '+1.633912E+002', '+1.483224E+002', '+1.620106E+002', '+1.601923E+002', '+1.480895E+002', '+1.578381E+002', '+1.538800E+002', '+1.560681E+002', '+1.555004E+002', '+1.551293E+002', '+1.540278E+002', '+1.538509E+002', '+1.137378E+002', '+1.149281E+002', '+1.331568E+002', '+1.163174E+002', '+1.484713E+002', '+1.374809E+002', '+1.209934E+002', '+1.355725E+002', '+1.244279E+002', '+1.306587E+002', '+1.331157E+002', '+1.183870E+002', '+1.453551E+002', '+1.456716E+002', '+1.460490E+002', '+1.468411E+002', '+1.246836E+002', '+1.068057E+002', '+1.070509E+002', '+1.058016E+002', '+1.050916E+002', '+1.045803E+002', '+1.040473E+002', '+1.038528E+002', '+1.035256E+002', '+1.031659E+002', '+1.036214E+002', '+1.028437E+002', '+1.025061E+002', '+1.020744E+002', '+1.012982E+002', '+1.005843E+002', '+9.998238E+001', '+9.969476E+001', '+9.923706E+001', '+9.881256E+001', '+9.842982E+001', '+9.800894E+001', '+9.748767E+001', '+9.712620E+001', '+9.671126E+001', '+9.626345E+001', '+9.584901E+001', '+9.545324E+001', '+9.508974E+001', '+9.469621E+001', '+9.432220E+001', '+9.393491E+001', '+9.353947E+001', '+9.313336E+001', '+9.277773E+001', '+9.238824E+001', '+9.200987E+001', '+9.167109E+001', '+9.128713E+001', '+9.091743E+001', '+9.057329E+001', '+9.020973E+001', '+8.984316E+001', '+8.949557E+001', '+8.912196E+001', '+8.875691E+001', '+8.841611E+001', '+8.805997E+001', '+8.772364E+001', '+8.736395E+001', '+8.701781E+001', '+8.669288E+001', '+8.634227E+001', '+8.601115E+001', '+8.567466E+001', '+8.535136E+001', '+8.501521E+001', '+8.468584E+001', '+8.436098E+001', '+8.402540E+001', '+8.369189E+001', '+8.339007E+001', '+8.306447E+001', '+8.268069E+001', '+8.237523E+001', '+8.205933E+001', '+8.173785E+001', '+8.143002E+001', '+8.110356E+001', '+8.081547E+001', '+8.049152E+001', '+8.018866E+001', '+7.988463E+001', '+7.958813E+001', '+7.929669E+001', '+7.898972E+001', '+7.870305E+001', '+7.840586E+001', '+7.810417E+001', '+7.781810E+001', '+7.751254E+001', '+7.724322E+001', '+7.695685E+001', '+7.667106E+001', '+7.638483E+001', '+7.608351E+001', '+7.582215E+001', '+7.553214E+001', '+7.525329E+001', '+7.498496E+001', '+7.471650E+001', '+7.443971E+001', '+7.415194E+001', '+7.388024E+001', '+7.361698E+001', '+7.334940E+001', '+7.308756E+001', '+7.281303E+001', '+7.254472E+001', '+7.226702E+001', '+7.201777E+001', '+7.174941E+001', '+7.147430E+001', '+7.121555E+001', '+7.096093E+001', '+7.071474E+001', '+7.045128E+001', '+7.021187E+001', '+6.993744E+001', '+6.967589E+001', '+6.944630E+001', '+6.917857E+001', '+6.895017E+001', '+6.870533E+001', '+6.844669E+001', '+6.820834E+001', '+6.795781E+001', '+6.770843E+001', '+6.745764E+001', '+6.723641E+001', '+6.698412E+001', '+6.674328E+001', '+6.652545E+001', '+6.619181E+001', '+6.596429E+001', '+6.571574E+001', '+6.548972E+001', '+6.525136E+001', '+6.502782E+001', '+6.480130E+001', '+6.456667E+001', '+6.434721E+001', '+6.412099E+001', '+6.388386E+001', '+6.366047E+001', '+6.343237E+001', '+6.320449E+001', '+6.298954E+001', '+6.276783E+001', '+6.255270E+001', '+6.232435E+001', '+6.210109E+001', '+6.188115E+001', '+6.166356E+001', '+6.143953E+001', '+6.121707E+001', '+6.100292E+001', '+6.078659E+001', '+6.057097E+001', '+6.035145E+001', '+6.014175E+001', '+5.991059E+001', '+5.970481E+001', '+5.949521E+001', '+5.927445E+001', '+5.907165E+001', '+5.885614E+001', '+5.864709E+001', '+5.843498E+001', '+5.822685E+001', '+5.801301E+001', '+5.780876E+001', '+5.759846E+001', '+5.739663E+001', '+5.718951E+001', '+5.698102E+001', '+5.678605E+001', '+5.657612E+001', '+5.637002E+001', '+5.616689E+001', '+5.596377E+001', '+5.576709E+001', '+5.557257E+001', '+5.536623E+001', '+5.516058E+001', '+5.496573E+001', '+5.476174E+001', '+5.456344E+001', '+5.436157E+001', '+5.416981E+001', '+5.397050E+001', '+5.377424E+001', '+5.357103E+001', '+5.336912E+001', '+5.316929E+001', '+5.297410E+001', '+5.276654E+001', '+5.257870E+001', '+5.238750E+001', '+5.220484E+001', '+5.204231E+001', '+5.190308E+001', '+5.178245E+001', '+5.165954E+001', '+5.153503E+001', '+5.138365E+001', '+5.120867E+001', '+5.102927E+001', '+5.083576E+001', '+5.065108E+001', '+5.045392E+001', '+5.025868E+001', '+5.006661E+001', '+4.988470E+001', '+4.969613E+001', '+4.951303E+001', '+4.933138E+001', '+4.914930E+001', '+4.896135E+001', '+4.877748E+001', '+4.860034E+001', '+4.841330E+001', '+4.824212E+001', '+4.806575E+001', '+4.788797E+001', '+4.771051E+001', '+4.753675E+001', '+4.735909E+001', '+4.718176E+001', '+4.700731E+001', '+4.683031E+001', '+4.665898E+001', '+4.648703E+001', '+4.631637E+001', '+4.614460E+001', '+4.597308E+001', '+4.580191E+001', '+4.562511E+001', '+4.545533E+001', '+4.528366E+001', '+4.512331E+001', '+4.495305E+001', '+4.478601E+001', '+4.461633E+001', '+4.444767E+001', '+4.428210E+001', '+4.411116E+001', '+4.395391E+001', '+4.379014E+001', '+4.362938E+001', '+4.346444E+001', '+4.330422E+001', '+4.313985E+001', '+4.298162E+001', '+4.282053E+001', '+4.265580E+001', '+4.250266E+001', '+4.234859E+001', '+4.218993E+001', '+4.203496E+001', '+4.188165E+001', '+4.172267E+001', '+4.156570E+001', '+4.141064E+001', '+4.125544E+001', '+4.110427E+001', '+4.095432E+001', '+4.080393E+001', '+4.065228E+001', '+4.049882E+001', '+4.034602E+001', '+4.018733E+001', '+4.003918E+001', '+3.989019E+001', '+3.974211E+001', '+3.959248E+001', '+3.943698E+001', '+3.928801E+001', '+3.913195E+001', '+3.897686E+001', '+3.882536E+001', '+3.867223E+001', '+3.852634E+001', '+3.837497E+001', '+3.822211E+001', '+3.806639E+001', '+3.791784E+001', '+3.776393E+001', '+3.760722E+001', '+3.746251E+001', '+3.731363E+001', '+3.716455E+001', '+3.701986E+001', '+3.687104E+001', '+3.672052E+001', '+3.657313E+001', '+3.642542E+001', '+3.628076E+001', '+3.614508E+001', '+3.600813E+001', '+3.586538E+001', '+3.573092E+001', '+3.559783E+001', '+3.545735E+001', '+3.531992E+001', '+3.518596E+001', '+3.505482E+001', '+3.491584E+001', '+3.478728E+001', '+3.464755E+001', '+3.450635E+001', '+3.436318E+001', '+3.422562E+001', '+3.408432E+001', '+3.394158E+001', '+3.380819E+001', '+3.366784E+001', '+3.352764E+001', '+3.339268E+001', '+3.325951E+001', '+3.312002E+001', '+3.298310E+001', '+3.285632E+001', '+3.273411E+001', '+3.260328E+001', '+3.248444E+001', '+3.235519E+001', '+3.223281E+001', '+3.209831E+001', '+3.196900E+001', '+3.184067E+001', '+3.171203E+001', '+3.158613E+001', '+3.145369E+001', '+3.132057E+001', '+3.118515E+001', '+3.104594E+001', '+3.090917E+001', '+3.076966E+001', '+3.062852E+001', '+3.048870E+001', '+3.034690E+001', '+3.021327E+001', '+3.006848E+001', '+2.992911E+001', '+2.978255E+001', '+2.963571E+001', '+2.949521E+001', '+2.935749E+001', '+2.922154E+001', '+2.908255E+001', '+2.894538E+001', '+2.880389E+001', '+2.866224E+001', '+2.852138E+001', '+2.838099E+001', '+2.824103E+001', '+2.810569E+001', '+2.796936E+001', '+2.782681E+001', '+2.769358E+001', '+2.755541E+001', '+2.741259E+001', '+2.727313E+001', '+2.713605E+001', '+2.699783E+001', '+2.686083E+001', '+2.672147E+001', '+2.658437E+001', '+2.644625E+001', '+2.630801E+001', '+2.616512E+001', '+2.603101E+001', '+2.589232E+001', '+2.575454E+001', '+2.561644E+001', '+2.547833E+001', '+2.534183E+001', '+2.520264E+001', '+2.505910E+001', '+2.492208E+001', '+2.477909E+001', '+2.464663E+001', '+2.451152E+001', '+2.437465E+001', '+2.423483E+001', '+2.409598E+001', '+2.395972E+001', '+2.382007E+001', '+2.367959E+001', '+2.354270E+001', '+2.340146E+001', '+2.326394E+001', '+2.312208E+001', '+2.298558E+001', '+2.283982E+001', '+2.269906E+001', '+2.255732E+001', '+2.241614E+001', '+2.227514E+001', '+2.214171E+001', '+2.199491E+001', '+2.185603E+001', '+2.171301E+001', '+2.157040E+001', '+2.143086E+001', '+2.128905E+001', '+2.115195E+001', '+2.101151E+001', '+2.087426E+001', '+2.073877E+001', '+2.059953E+001', '+2.045867E+001', '+2.031900E+001', '+2.018134E+001', '+2.004735E+001', '+1.991422E+001', '+1.977881E+001', '+1.964567E+001', '+1.951425E+001', '+1.938622E+001', '+1.925342E+001', '+1.912563E+001', '+1.899960E+001', '+1.887360E+001', '+1.875029E+001', '+1.862742E+001', '+1.850768E+001', '+1.838442E+001', '+1.826034E+001', '+1.814026E+001', '+1.801099E+001', '+1.789039E+001', '+1.777108E+001', '+1.764902E+001', '+1.752822E+001', '+1.741544E+001', '+1.729658E+001', '+1.718318E+001', '+1.706901E+001', '+1.696012E+001', '+1.685051E+001', '+1.673970E+001', '+1.663136E+001', '+1.651960E+001', '+1.640636E+001', '+1.628257E+001', '+1.616190E+001', '+1.603957E+001', '+1.591751E+001', '+1.578919E+001', '+1.566058E+001', '+1.552285E+001', '+1.538595E+001', '+1.523934E+001', '+1.508937E+001', '+1.494112E+001', '+1.478972E+001', '+1.463580E+001', '+1.447811E+001', '+1.431762E+001', '+1.415689E+001', '+1.399179E+001', '+1.382116E+001', '+1.365070E+001', '+1.348708E+001', '+1.332933E+001', '+1.317231E+001', '+1.301657E+001', '+1.285960E+001', '+1.270512E+001', '+1.254426E+001', '+1.238700E+001', '+1.223031E+001', '+1.207788E+001', '+1.192497E+001', '+1.177854E+001', '+1.162967E+001', '+1.148486E+001', '+1.134234E+001', '+1.120537E+001', '+1.106905E+001', '+1.094538E+001', '+1.082553E+001', '+1.071436E+001', '+1.061366E+001', '+1.051900E+001', '+1.043256E+001', '+1.035990E+001', '+1.030024E+001', '+1.025809E+001', '+1.022952E+001', '+1.021560E+001', '+1.022234E+001', '+1.023454E+001', '+1.027127E+001', '+1.031346E+001', '+1.037197E+001', '+1.044420E+001', '+1.052554E+001', '+1.061443E+001', '+1.070701E+001', '+1.080547E+001', '+1.090605E+001', '+1.100354E+001', '+1.110940E+001', '+1.121485E+001', '+1.132166E+001', '+1.143146E+001', '+1.154234E+001', '+1.165479E+001', '+1.176454E+001', '+1.188949E+001', '+1.201623E+001', '+1.216325E+001', '+1.232034E+001', '+1.248926E+001', '+1.266935E+001', '+1.284831E+001', '+1.302880E+001', '+1.321305E+001', '+1.338861E+001', '+1.355856E+001', '+1.372606E+001', '+1.387506E+001', '+1.401838E+001', '+1.414206E+001', '+1.424846E+001', '+1.433813E+001', '+1.440696E+001', '+1.446216E+001', '+1.449575E+001', '+1.451489E+001', '+1.452298E+001', '+1.450891E+001', '+1.447875E+001', '+1.443446E+001', '+1.437745E+001', '+1.430042E+001', '+1.421729E+001', '+1.412605E+001', '+1.402558E+001', '+1.391923E+001', '+1.380617E+001', '+1.368942E+001', '+1.356938E+001', '+1.344040E+001', '+1.331113E+001', '+1.317116E+001', '+1.304476E+001', '+1.291496E+001', '+1.277679E+001', '+1.264594E+001', '+1.251228E+001', '+1.237501E+001', '+1.223723E+001', '+1.211293E+001']
self.mplwidgetUp.axes.plot(data1,'#3FF235');
So now my question is how I can add a marker on some value.
To be honest I've tried different stuffs but I delete them and they were a lot of stuffs f.e.
self.mplwidgetUp.axes.plot(data1, marker="o", '#3FF235');
Its giving me an error:
self.mplwidgetUp.axes.plot(data1, marker="o", '#3FF235');
SyntaxError: non-keyword arg after keyword arg
I also've tried with:
self.mplwidgetUp.axes.plot(data1,'#3FF235');
self.mplwidgetUp.axes.plot(data1[270], "ro");
But it is giving me the point somewhere entirely different on the plot(in the lower left corner). Where 270 is the index of the array where is the max value (its an example i dont know exactly where the maximum is till now)
Can someone please help me I am struggling with this problem whole day.
Thank you in advance
Using this syntax:
plot(..., marker="o")
is using a "keyword" argument, as opposed to simply a "positional" argument which has no keyword= at the beginning, as in:
plot(x, y, '#3FF235')
You can mix them both, as long as the "positional" arguments come before the "keyword" arguments. This should work:
plot(x, y, '#3FF235', marker='o')
But this won't:
plot(x, y, marker='o', '#3FF235')
Note that x, y must be two separate arguments. If you want to mark only point 270, you have to do:
plot(270, data1[270], '#3FF235', marker='o')
To show the actual max, use
data1 = np.asarray(data1, float)
maxi = data1.argmax()
plot(maxi, data1[maxi], 'ro') # can combine color and marker in one positional argument
Doesn't the phrase "non-keyword arg after keyword arg" make you want to investigate what that actually means, rather than just try stuff randomly? In general, the Python syntax func(a, b) is fine (no keyword args), and func(a, option=b) is also fine (there's a keyword arg named "option" at the end; but func(option=b, a) is not allowed (it doesn't know how to interpret the non-keyword arg a after the keyword arg option=b). Your missing keyword is, I believe, color.