Colleagues, good afternoon!
Help solve the problem with the substitution of values from the list in the column. There are 2 data frames (old and new) and a list:
spisok = ['Ivanov', 'Petrov', 'Sidorov']
df_old:
id score revie_date in_charge 111 4 08.10.2019 Petrov 123 2 04.03.2019 Sidorov 145 5 04.04.2019 Ivanov 135 6 20.05.2019 Petrov 222 5 25.06.2019 Sidorov
df_new
id score revie_date in_charge 367 6 18.07.2019 123 2 04.03.2019 257 5 04.06.2019 945 6 01.05.2019 222 5 25.06.2019
The task is to assign an artist from spisok in an arbitrary order, but make it so that the tasks are distributed more or less equally (that is, there can be more than 1000 rows in the data frame).
Compare with the old list and if there are coincidences there by id, then take the executor / replace from the old list.
That the result was something like this:
df_new:
id score revie_date in_charge 367 6 18.07.2019 Ivanov 123 2 04.03.2019 Sidorov 257 5 04.06.2019 Petrov 945 6 01.05.2019 Ivanov 222 5 25.06.2019 Sidorov
I tried to do it through
df_new['in_charge'] = np.random.choice(spisok, size=len(df_new))
but the result is completely not the same distributed equally and then how to compare with the previous df_old.