I tried to use groupby to group rows with multiple values.
col val A Cat A Tiger B Ball B Bat import pandas as pd df = pd.read_csv(\"Inputfile.txt\", s
just try
group = df.groupby(['col'])['val'].apply(lambda x: '-'.join(x))