I have a list of lists of different lengths. From each list of lists, I need to randomly select 10 items. Then I have to combine the results in a single list with each list item separated by comma. (Pls see the output below). Not sure whether this is possible in Python. Any help would be appreciated.
[[-26.0490761 27.79991 ]
[-25.9444218 27.9116535]
[-26.1055737 27.7756424]
...,
[-26.036684 28.0508919]
[-26.1367035 28.2753029]
[-26.0668163 28.1137161]]
[[ 45.35693 -63.1701241]
[ 44.6566162 -63.5969276]
[ 44.7197456 -63.48137 ]
...,
[ 44.624588 -63.6244736]
[ 44.6563835 -63.679512 ]
[ 44.66706 -63.621582 ]]
I would like to get the output in this format that is suitable for plotting them on a map using Folium.
[[-26.0490761 27.79991],
[-25.9444218 27.9116535],
[ 44.6563835 -63.679512 ],
[ 44.66706 -63.621582 ]]
I tried this code but not sure what went wrong:
for cluster in clusters:
for i in range(2):
modifiedlist.append(cluster)