@@ -954,13 +954,31 @@ def add_dataset(
954954 zero_indexed_set  =  set (range (len (class_names )))
955955 if  unique_labels  !=  zero_indexed_set :
956956 raise  exceptions .OpenlayerResourceError (
957-  context = f"There's an issue with values in the column `{ label_column_name } \n " ,
958-  message = f"The labels in `{ label_column_name } \n " ,
959-  mitigation = "Make sure to upload a dataset with zero-indexed integer labels that match " 
960-  f"the list in `class_names`. For example, the class `{ class_names [0 ]}  
961-  f" the class `{ class_names [1 ]}  ,
957+  context = f"There's an issue with values in the column " 
958+  f"`{ label_column_name } \n " ,
959+  message = f"The labels in `{ label_column_name }  
960+  "zero-indexed integer values. \n " ,
961+  mitigation = "Make sure to upload a dataset with zero-indexed " 
962+  "integer labels that match the list in `class_names`. " 
963+  f"For example, the class `{ class_names [0 ]}  
964+  "represented as a 0 in the dataset, the class " 
965+  f"`{ class_names [1 ]}  ,
962966 ) from  None 
963967
968+  # Validating the column dtypes 
969+  supported_dtypes  =  {"float32" , "float64" , "int32" , "int64" , "object" }
970+  error_msg  =  "" 
971+  for  col  in  df :
972+  dtype  =  df [col ].dtype .name 
973+  if  dtype  not  in supported_dtypes :
974+  error_msg  +=  f"- Column `{ col } { dtype } \n " 
975+  if  error_msg :
976+  raise  exceptions .OpenlayerResourceError (
977+  context = "There is an issue with some of the columns dtypes.\n " ,
978+  message = error_msg ,
979+  mitigation = f"The supported dtypes are { supported_dtypes }  
980+  "Make sure to cast the above columns to a supported dtype." ,
981+  ) from  None 
964982 # ------------------ Resource-schema consistency validations ----------------- # 
965983 # Label column validations 
966984 try :
0 commit comments