DataFrame.explode returns a PY[object] column, even if coercible to something better #377
-
To Reproduce
Expected behavior
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Thanks for raising this! This is expected behavior since we can't currently infer any return types of operations on Py columns without some form of user input. For example, if a user's Python list looks like this:
We can only deduce that the type of the However, by casting the resulting exploded dataframe, the user is asserting that the data is of a given type and Daft will throw a runtime error if that assertion proves to be false. We could perhaps include a way to cast the data from the explode method, similar to the |
Beta Was this translation helpful? Give feedback.
-
Additionally, in the second case ( #335 tracks the issue for adding complex arrow types |
Beta Was this translation helpful? Give feedback.
-
Closing and converting issue to a discussion for future reference! |
Beta Was this translation helpful? Give feedback.
Thanks for raising this!
This is expected behavior since we can't currently infer any return types of operations on Py columns without some form of user input.
For example, if a user's Python list looks like this:
We can only deduce that the type of the
"a"
column is a list but Daft has no typing information about its contents at static time. Without knowing the contents of the data itself ahead of time, Daft cannot make any decisions about the elements' types at static time.However, by casting the resulting exploded dataframe, the user is asserting that the data is of a given type and Da…