How to change each data inside the data series, let me explain in detail. I have a cricket match dataset and I want to find out how many times two teams play against each other from the whole dataset.
team_names total_count
['Afghanistan','Bangladesh'] 1
I got a result where 'Afghanistan' and 'Bangladesh' play 1 time against each other. But here I want to modify this data frame. Instead of showing ['Afghanistan', 'Bangladesh'], I want to display data like:
team_names total_count
'Afghanistan-Bangladesh' 1
How to do this?
(I have tried:
1) df["team_names1"] = df['team_names'].str.join("-")
2) df['team_names1'] = df['team_names'].apply(lambda x: '-'.join(x))
3) df['team_names1'] = df['team_names'].apply(lambda x: '-'.join(x),1)
but none of them gives me correct output. All the above code produce the same output:
team_names total_count
[-'-A-f-g-h-a-n-i-s-t-a-n-'-,- -'-B-a-n-g-l-a-..] 1
