Empty dataframe row as a copy of existing DF

I found a question very similar to this but it doesn’t work for my situation.

I have an existing dataframe. I’m using groupby on it, however, the function which looks at the group is an all or nothing evalution. That is, if the group “passes” the whole group is returned otherwise and empty row should be returned.

What this means, is that if I have a dataframe

x=DataFrame([[1],[1]], [:a, :b])

what I want to do is to return an empty row of the same DataFrame type of x. This works, but requires me to explicitly construct the empty array, which means the code breaks the day my dataframe changes.

y=DataFrame([[],[]], names(x))

Since i have an existing DF it seems to me like there must be someway to create an empty row of the particular DataFrame type, right ? Having no luck finding it. ALL of the examples I’ve seen require “manual” intervention of some sort.


oh good grief. I was just sure i tried this and it didn’t work, which surprised me, because I thought it should have…

DataFrame(eltypes(x), names(x))

really, I was just sure I tried that…