I want to create a random tool for a station rotation for the names: I have a given Dataframe with the following shape:
data = {'Name': ['Tom', 'Mike', 'Carl', 'Juli', 'Tina', 'Wendy'],
'station1': [0, 1, 1, 1, 0, 0],
'station2': [1, 1, 1, 1, 1, 0],
'station3': [1, 1, 1, 1, 1, 1],
'station4': [1, 1, 1, 1, 1, 1],
'station5': [0, 1, 0, 0, 1, 0],
'station6': [1, 1, 0, 1, 1, 0]}
4x rotation = 4 postions in list
Restrictions for rotations: no double station at for e.g. 1st position in each list no station following each other, and if possible Wendy can only do 2 stations, so a double change is minimum. (see at expeced result below)
I think working with list is the best way, but not sure if 4-D array is also a choice.
my prgress so far:
- replace 1 with 'station_'
- swapaxes()
- creat lists for each name
- delete 'nan's in name lists
- set name as list name and delete name from list (so lists have different len)
- ... no idea, maybe sort by length?
- ... maybe pic and check by column/rows?
List should be like
Wendy = ['station4','station3','station4','station3']
Mike = ['station1','station2','station5','station6']
...
Tom = ['station2','station4','station6','station2']
I know is tricky and difficult, but i have no clue how to coninue
Aucun commentaire:
Enregistrer un commentaire