Neil Wadhvana
11/23/2024, 8:26 PMpandas and then moving the data into daft.
This is a requirement due to the remote storage loading which daft supports with download()
Once the files are loaded, I need to perform an explode() on the object column, which requires that I first cast(daft.DataType.list(daft.DataType.python()). Daft is not happy.
Is there any other first-party way to work with this data?Neil Wadhvana
11/23/2024, 8:33 PMdownload() apply(..., json.loads), cast(...), explode()jay
11/23/2024, 8:34 PMNeil Wadhvana
11/23/2024, 8:39 PMapply, I get: Daft casting from Struct ... to Python not implemented.
Is there a way to get daft to auto-cast the struct?jay
11/23/2024, 8:39 PMNeil Wadhvana
11/23/2024, 8:40 PMdef parse_json_binary(df: daft.DataFrame) -> daft.DataFrame:
return df.with_column(
"json_objects",
df["json"].apply(
json.loads,
return_dtype=daft.DataType.list(daft.DataType.python()),
# return_dtype=daft.DataType.python(),
),
)jay
11/23/2024, 8:41 PMNeil Wadhvana
11/23/2024, 8:43 PMNeil Wadhvana
11/23/2024, 8:45 PMjay
11/24/2024, 1:46 AMNeil Wadhvana
11/24/2024, 7:44 PMdf.infer_python(), it may be possible to understand what daft may internally convert a column's datatype to.
Perhaps, df["col_name"].infer_python() would be more efficient and precise.