darabos commited on
Commit
3da02a8
·
1 Parent(s): 6373590

Convert table data to strings, to make sure JSON serialization works.

Browse files
lynxkite-graph-analytics/src/lynxkite_graph_analytics/lynxkite_ops.py CHANGED
@@ -432,6 +432,11 @@ def collect(df: pd.DataFrame):
432
  df = df.collect()
433
  if isinstance(df, pl.DataFrame):
434
  return [[d[c] for c in df.columns] for d in df.to_dicts()]
 
 
 
 
 
435
  return df.values.tolist()
436
 
437
 
 
432
  df = df.collect()
433
  if isinstance(df, pl.DataFrame):
434
  return [[d[c] for c in df.columns] for d in df.to_dicts()]
435
+ # Convert non-numeric columns to strings.
436
+ df = df.copy()
437
+ for c in df.columns:
438
+ if not pd.api.types.is_numeric_dtype(df[c]):
439
+ df[c] = df[c].astype(str)
440
  return df.values.tolist()
441
 
442