-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add missing columns when push! ing? #2150
Comments
I think it is a duplicate (actually a subset) of #2032. Could you please have a look there and if yes this can be closed. Just as a comment - things are not easy here as you have to decide about widening rule. If you have a column of In particular - maybe you want something simpler, which could be implemented before #2032. Something like Now having to call
In short - we know about the problem, but the decision what is a robust and future proof design here is hard 😭, so for now we disallowed this. If you would have an idea of a minimal API extension that would do what is expected most of the time then it would be great (my fear is that having fully flexible API here would be an overkill for a regular user, but maybe I am wrong). |
We could expand |
The problem is how we should determine the return type? Would you want to dispatch on a first argument to Also I think converting via |
Yes I think it is best to keep This could also be handled at the Tables.jl level, which could provide a function to fill in columns and expand types as needed. For example
|
I did not know about this. So
@quinnj - is this intended, or this is just a consequence of performance considerations? |
For any Tables.jl source without a well-defined schema (i.e. returns |
Actually what the example at #2150 (comment) shows is that new columns that appear after the first row are silently ignored. Is that intended? |
Ah - right, so it is |
Yes, extra columns not in the first row will be ignored; what I meant in my comment is that if the first row has extra columns that aren't present in subsequent rows, that would be an error (since it would be trying to get a column that didn't exist on later rows). |
Yes - this is exactly |
I'm trying to build up a data frame one row at a time, except that not every row has all the columns. I'd like to be able to
push!
the rows on one at a time, filling in the missing columns withmissing
. usingcols=:subset
gets me halfway there:But notice that no column for
c
is added. Having to callallowmissing!
is also potentially annoying since I'll have to call that for every row or have to do the bookkeeping of keeping track of which columns have already missings in them in the loop over rows. But I think that's more related to #1716 .I'd like either an additional argument like
fill
, or another value forcols
which opts into adding columns as they are encountered.The text was updated successfully, but these errors were encountered: