JuliaData / JuliaData/DataFrames.jl
Initializing Dataframe from vector of named tuples: missing values
Open
Nobody has claimed this yet.
decision
- Dominant language
- Julia
- Stars
- 1.8k
- Forks
- 372
- Avg merge
- 5d 7h
- Merged PRs (30d)
- 5
Description
When I initialize my dataframe using
df = DataFrame([(a=1,b=2), (a=3,b=4), (a=1,)])
I would expect to get
| a | b |
|---|---|
| 1 | 2 |
| 3 | 4 |
| 1 | missing |
Instead I get an error
ERROR: type NamedTuple has no field b
Stacktrace:
[1] getproperty
@ ./Base.jl:37 [inlined]
[2] getcolumn
@ ~/.julia/packages/Tables/AcRIE/src/Tables.jl:102 [inlined]
Is there a simple way to get the former behavior? Should it be what DataFrames does by default instead of throwing an error?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the DataFrame constructor example and inspect Tables.jl getcolumn at the location shown in the stack trace. Determine the intended handling for an absent named-tuple field, then verify that the example produces column b values 2, 4, and missing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100