Need guidance with a shift scheduler

It is my notebook,
It contains a table of January, with a list of residents’ names.
each cell may be filled with ‘1’, ‘3’, ’ '.

  • ‘1’ - block the date for a shift
  • ‘3’ - prefer the date for a shift
  • ’ ’ - if left empty, the date might be used for a shift

I am done with the data cleaning and stuck with the approach of how to randomly assign the names on the dates with the conditions applied.