-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
coerce float if string or tuple #569
base: master
Are you sure you want to change the base?
Conversation
@@ -393,6 +393,28 @@ def convert_money_string_to_float(money: str): | |||
mask = where_is_currency_column(df, col) | |||
df[col, mask] = df[col, mask].apply(convert_money_string_to_float) | |||
|
|||
def try_coerce_to_numeric(ndf: pd.DataFrame): | |||
try: | |||
nndf = ndf.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:(
nndf = ndf.copy() | ||
object_columns = nndf.select_dtypes(include=['object']).columns | ||
for j in object_columns: | ||
num_floats = sum(isinstance(x, float) for x in nndf[j].dropna()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slow, and weird to check for floats in a col marked as object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@silkspace @tanmoyio this seems slow and surprising to put in the critical path for most gpu umap calls?
for rare cases first encountered in avr-59k['Source_IP4_Subnet_16'] dataset, for example
graphistry.nodes(avr59k_splunk['Source_IP4_Subnet_16'].dropna()).umap()
would throw type error
see end of this thread