Nov-25-2020, 08:38 PM
Hello,
I have list like that:
First how many [000], [001] ,[010],[011]…(all triplet combinations of 0 and 1) according to last element of the array (last element are (1.57, 0, 1.57),(0, 1.57, 0),(1.57, 0, 0)…)
For instance in the first sublist I have 3 times [0, 1, 1] 1 times [111], 1 times [000] and 1 times [101] and for the forst sublist I have 7 elements except (0, 1.57, 0)
Second, I want to count how many element there are of each subarray except last element (last elements means that element is inside ()) For instance in the first sublist I have 7 element except (0, 1.57, 0)
I can count somethong woth the following line but it counts total [000], [001] ,[010],[011]…
I want to count sublist by sublist
Thanks for helps...
I have list like that:
Output:newlist22 [[[0, 1, 1], [0, 1, 1], [1, 0, 1], [0, 0, 0], [1, 1, 1], [0, 1, 1], [1, 0, 1], (0, 1.57, 0)], [[1, 0, 0], [0, 1, 0], [1, 1, 1], [1, 1, 0], [1, 0, 0], [1, 1, 1], [0, 1, 1], (1.57, 0, 1.57)],
[[0, 1, 1], [1, 1, 0], [1, 0, 1], [0, 1, 1], [1, 0, 1], [0, 1, 1], [0, 0, 1], [0, 1, 1], (1.57, 0, 0)], [[0, 1, 1], [0, 1, 0], [0, 1, 0], [0, 0, 1], [0, 0, 0], [0, 1, 0], [0, 1, 0], (0, 1.57, 1.57)],
[[1, 0, 1], [0, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 0], [1, 1, 1], [0, 0, 0], [0, 0, 0], (0, 0, 0)], [[0, 1, 0], [1, 0, 1], [1, 0, 1], [0, 0, 0], [0, 1, 1], [0, 0, 0], [1, 1, 0], (1.57, 1.57, 1.57)],
[[0, 0, 0], [0, 1, 1], [0, 1, 0], [0, 0, 0], [0, 0, 0], [1, 1, 0], [0, 1, 1], [1, 1, 0],(0, 0, 1.57)], [[0, 1, 0], [1, 1, 1], [0, 0, 0], (1.57, 1.57, 0)]]
Now I want to countFirst how many [000], [001] ,[010],[011]…(all triplet combinations of 0 and 1) according to last element of the array (last element are (1.57, 0, 1.57),(0, 1.57, 0),(1.57, 0, 0)…)
For instance in the first sublist I have 3 times [0, 1, 1] 1 times [111], 1 times [000] and 1 times [101] and for the forst sublist I have 7 elements except (0, 1.57, 0)
Second, I want to count how many element there are of each subarray except last element (last elements means that element is inside ()) For instance in the first sublist I have 7 element except (0, 1.57, 0)
I can count somethong woth the following line but it counts total [000], [001] ,[010],[011]…
I want to count sublist by sublist
triplets = tuple(itertools.product((0, 1), repeat = 3)) for triple in triplets: sums[triple] = sum(np.all((newlist22-np.array(triple))==0, axis=1))How can I solve this problem
Thanks for helps...