Skip to content

Does complete() work with Dates? #67

Answered by pbeshai
hughess asked this question in Q&A
Discussion options

You must be logged in to vote

Normal complete on "date" and "country" should work in this case if your dates are strings as shown above.

tidy(input,
  complete(["date", "country"], { value: 0 }),
)

Produces

[
  {"date": "2020-01-01", "country": "Canada", "value": 100},
  {"date": "2020-01-01", "country": "US", "value": 150},
  {"date": "2020-01-01", "country": "UK", "value": 0},
  {"date": "2020-02-05", "country": "Canada", "value": 200},
  {"date": "2020-02-05", "country": "US", "value": 250},
  {"date": "2020-02-05", "country": "UK", "value": 220},
  {"date": "2020-03-14", "country": "Canada", "value": 300},
  {"date": "2020-03-14", "country": "US", "value": 0},
  {"date": "2020-03-14", "country": "UK", "value": 320}…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by pbeshai
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants