I want to replace single string with list of string in the data frame column. I have tried below code but not able to do. It is only replacing single string.
import pandas as pd
# initialize list of lists
data = [['tom', 10,'aaaaa'], ['nick', 15,'vvvvv'], ['juli', 14,'sssssss']]
# Create the pandas DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age','sex'])
replacements = {'aaaaa': ['M','H'],'vvvvv': ['F','L']}
df['new']=df['sex'].replace(replacements)
print(df)
Getting error ValueError: cannot assign mismatch length to masked array. Could you pleae help me to resolve this issue.