Last active
February 25, 2019 19:15
-
-
Save allanaguilar/646ccc1e40c3570ae6357c526a8d4eef to your computer and use it in GitHub Desktop.
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
# CONVERT ANY STRING TO FLOAT | |
def string_to_float(v): | |
if isinstance(v, (int, float)): | |
res = v | |
else: | |
v2 = v.replace(",","") | |
res = float(v2) if v2.replace(".","").isdigit() else 0 | |
return res | |
# SHORT LOOP FOR | |
[doc["doc"] for doc in rows if 'views' not in doc["doc"]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment