I have been receiving "TypeError: 'Series' objects are mutable, thus they cannot be hashed." And while I understand what it means, I can't seem to work out a solution. I have tried converting the series to a tuple (as seen below) since tuples are immutable. I am receiving the same error message. Any idea how I can fix this problem?
import pandas as pd
data_file = pd.read_csv("file:///C:/Users/carte/OneDrive/Desktop/TEST.csv")
Jordan = []
Carter = []
Reece = []
Liam = []
Bryce = []
David = []
Jordan = data_file['Jordan']
Carter = data_file['Carter']
Reece = data_file['Reece']
Liam = data_file['Liam']
Bryce = data_file['Bryce']
David = data_file['David']
invite = []
invite.append(Carter)
invite.append(Jordan)
invite.append(Reece)
invite.append(David)
invite.append(Liam)
invite.append(Bryce)
tuple(invite)
invite = list(dict.fromkeys(invite))
print(invite)
For some context, my code is supposed to take all of the names on each list and remove the duplicates before printing a single list at the end.