Skip to content

Instantly share code, notes, and snippets.

@mickaellegal
Last active August 29, 2015 14:02
Show Gist options
  • Save mickaellegal/834914eb1a2942eed3ac to your computer and use it in GitHub Desktop.
Save mickaellegal/834914eb1a2942eed3ac to your computer and use it in GitHub Desktop.
Find unique string values in DataFrame that are not integer strings nor floats.
def get_unique_tracker_list(dataframe):
"""This function looks for unique string values in a dataframe."""
mylist = list(pd.Series(dataframe.values.ravel()).unique())
# Convert every element to a string.
templist = map(str, mylist)
# Return only the strings and deal with the floats.
mynewlist = [s for s in templist if s.replace(".", "", 1).isdigit() == False]
return mynewlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment