jeudi 16 février 2023

How to create rows of non-duplicating strings from a list?

I want to create a 16X4 data frame with these coordinates as strings: (.1,.1),(-.1,-.1),(-.1,.1),(.1,-.1). But, I do want not there to be duplicates.

To put it another way, the script would output a 16X4 matrix/dataframe like this:

(.1,.1),(-.1,-.1),(-.1,.1),(.1,-.1)
(-.1,.1),(-.1,-.1),(.1,.1),(.1,-.1)
(-.1,-.1),(.1,.1),(-.1,.1),(.1,-.1) ...

In this way, I would get all the possible combinations of these four coordinates with no column duplicates.

I have been trying to brainstorm solutions. I know I can put them in an array and use random.choice() to randomly sample. But, I am not sure how to form this code in such a way where there will be no column duplicates and that patterns wont repeat.




Aucun commentaire:

Enregistrer un commentaire