I need a function which takes in a list and outputs True if all elements in the input list evaluate as equal to each other using the standard equal
list
True
You can use .nunique() to find number of unique items in a list.
.nunique()
def identical_elements(list): series = pd.Series(list) if series.nunique() == 1: identical = True else: identical = False return identical identical_elements(['a', 'a']) Out[427]: True identical_elements(['a', 'b']) Out[428]: False