import pandas as pd
data = [[1, 'a', None, None], [1, None, 'r', None], [1, None, None, 's'], [
    2, None, 'd', None], [2, 'q', None, None], [3, None, 'b', None], [3,
    'w', None, None]]
Pandas. Group by field and merge the values in a single row