Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

dataFrameOf fails with no rows #125

Open
ablaagaard opened this issue Jul 9, 2021 · 3 comments
Open

dataFrameOf fails with no rows #125

ablaagaard opened this issue Jul 9, 2021 · 3 comments
Labels

Comments

@ablaagaard
Copy link

I tried
dataFrameOf("Col1", "Col2")()
but it fails with "Provided data does not coerce to tabular shape"

Maybe there is a better way to create an empty DataFrame with column names

@holgerbrandl
Copy link
Owner

No you're right. It should allow creating empty data-frames in exactly that way.

@holgerbrandl
Copy link
Owner

It turned out to be not that easy. The problem is the types of columns. With data, we can do type introspection, but without data we simply do not know the types of columns. So it might be that the short syntax is not applicable and we'd need to do

dataFrameOf(StringCol("user", emptyArray()), DoubleCol("salary", emptyArray()))

What do you think?

holgerbrandl added a commit that referenced this issue Jul 18, 2021
@ablaagaard
Copy link
Author

I believe I saw some column type conversion somewhere - like when you insert a String in Double column, then the column type is converted? Maybe following a similar pattern the column type doesn't really matter when it is empty, and can be inferred later, if data is added?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants