Open ablaagaard opened 3 years ago
No you're right. It should allow creating empty data-frames in exactly that way.
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?
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?
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