diff --git a/coml/prompt_utils.py b/coml/prompt_utils.py index 732f81c..55e88aa 100644 --- a/coml/prompt_utils.py +++ b/coml/prompt_utils.py @@ -56,13 +56,15 @@ def check_type(dtype: str, value): properties_list = [] for column in df.columns: - if not hasattr(df[column], "dtype"): + try: + dtype = df[column].dtype + except AttributeError: # This can sometimes happen when the column is a dataframe by itself properties_list.append( {"column": column, "properties": {"dtype": "unknown"}} ) + continue - dtype = df[column].dtype properties = {} if dtype in [int, float, complex]: properties["dtype"] = "number"