如何在列表中获取元组列表

33qvvth1  于 2021-07-13  发布在  Java
关注(0)|答案(3)|浏览(341)

那里
我要做的是把一个元组添加到一个列表中的元组列表中,我有下面的代码。。。subsets=[列表(m).extend(initialmedoid)for m in list(itertools.combinations(distances,2))]
例如,我有以下数据示例:
输入

initialMedoid = [('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])]
 arr = [[('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316])],
        [('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005])],
        [('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005])],
        [('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])]]

我想得到预期的结果
但是我却得到了一堆没有的

[None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]

预期产量

[[('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])],
[('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0]),('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])]]
14ifxucb

14ifxucb1#

是否附加 initialMedoid 到的每个列表元素 arr ?

subset = [m.append(initialMedoid[0]) for m in arr]
9w11ddsr

9w11ddsr2#

initialMedoid = [('ibis_142', [8.708170812, 0.0, 10.518235207, 7.668395996, 10.522399903, 7.302185059, 6.417022705, 6.146172005, 10.448354985, 5.149291993])]
 arr = [[('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('highway_bost174', [0.0, 8.708170812, 4.088197921, 11.366319879999999, 12.638763287, 11.078233943, 10.025102839, 8.415467337, 8.194840093, 13.455056175000001]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('street_par88', [4.088197921, 10.518235207, 0.0, 11.135904053, 11.472831274, 10.691568116, 9.663827636, 10.659660884000001, 9.392413013999999, 12.586018896]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('opencountry_241', [11.366319879999999, 7.668395996, 11.135904053, 0.0, 13.314941407, 2.754882813, 3.998626709, 9.028326501, 12.145703089000001, 8.675354002999999]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316])],
        [('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005])],
        [('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('waterfall23', [12.638763287, 10.522399903, 11.472831274, 13.314941407, 0.0, 12.665527344000001, 11.406341552, 12.6048929, 11.43774673, 8.79888916]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005])],
        [('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('field26', [11.078233943, 7.302185059, 10.691568116, 2.754882813, 12.665527344000001, 0.0, 3.349212646, 8.966176812, 11.827669236000002, 8.203674316]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]), ('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001])],
        [('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('mountain_030', [10.025102839, 6.417022705, 9.663827636, 3.998626709, 11.406341552, 3.349212646, 0.0, 8.78585096, 11.994283939999999, 7.7325744620000005]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]), ('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482])],
        [('horse_081', [8.415467337, 6.146172005, 10.659660884000001, 9.028326501, 12.6048929, 8.966176812, 8.78585096, 0.0, 8.054160893999999, 11.093641082000001]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])],
        [('bison_052', [8.194840093, 10.448354985, 9.392413013999999, 12.145703089000001, 11.43774673, 11.827669236000002, 11.994283939999999, 8.054160893999999, 0.0, 12.869559482]), ('ibis_040', [13.455056175000001, 5.149291993, 12.586018896, 8.675354002999999, 8.79888916, 8.203674316, 7.7325744620000005, 11.093641082000001, 12.869559482, 0.0])]]   
secArray = []
    for n in arr: 
      n = list(n)
      n.extend(initialMedoid)
      secArray.append(n)
myzjeezk

myzjeezk3#

你在做什么 list.append 列表理解和 .append 方法返回none,因此在最后您将得到 None 您可以直接使用原始列表,而不是列表理解的输出。
检查以下示例:
如果你不想改变原来的名单,你可以使用 arr 而不是它的副本。

arr_copy = arr.copy()
[x.extend(initialMedoid) for x in arr_copy]
print(arr_copy)

上面的代码将附加 initialMedoid 在您的每个子列表中 arr

相关问题