Last active
August 29, 2015 14:02
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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