4.Cleaning the Nationality and Gender Columns : tags:351-4

In the cleaning str mission, I didn’t give variable to row[2] and row[5] to remove the parenthesis from nationalities and genders. it worked for nationalities(row[2]) but didn’t work for gender(row[5]).

Is it the platform issue or am I doing something wrong?

for row in moma:
row[2] = row[2].replace("(", “”)
row[2] = row[2].replace(")", “”)
print(row[2])
row[5] = gender.replace("(", “”)
row[5] = gender.replace(")", “”)
print(row[5])

Console
American
(Male
Spanish
(Male
French
(Male
French
(Male
French
(Male
American
(Male
French
(Male
American
(Male
South African
(Male
Canadian

Don’t recall that particular mission but if I had to guess it’s due to you not referencing the column.
For the first section you’re specifically referencing a row (row[2]), but not with the second. If following the pattern as the first it’ll probably be:

row[5] = row[5].replace("(", “”)

1 Like