I want to know how I can correct my python code to get the gender columns correctly, this is my code and I attach the output that it gives me and the output that I want
import numpy as np
import pandas as pd
df=pd.read_csv("titles.csv",encoding='latin-1')
import ast
L = df['genres'].apply(ast.literal_eval).explode().unique().tolist()
i=0
index=[]
while i<19:
index.append(L[i])
i+=1
df_rows=df.shape[0]
genre_df=pd.DataFrame(np.zeros((df_rows,len(index))),columns=index)
final_df=pd.concat([df,genre_df],axis=1)
for row,genre_list in enumerate(final_df.genres):
for genre in genre_list:
final_df.loc[row,genre]=True
final_df.head()