Skip to content

Using Complete Function #121

Answered by pwwang
kellygfcengineering asked this question in Q&A
Discussion options

You must be logged in to vote

Is this what you wanted:

>>> from datar.all import c, f, tibble, complete
>>> 
>>> df = tibble(
...     Date=c("2020-01-01", "2020-01-02", "2020-01-03"),
...     BOM=c(1, 2, 3),
...     Work_Area=c("New York", "Arizona", "California"),
...     Quality=c(4, 5, 6),
... )
>>> 
>>> complete(df, f.Date, f.BOM, f.Work_Area, fill={"Quality": 0})
          Date     BOM   Work_Area   Quality
      <object> <int64>    <object> <float64>
0   2020-01-01       1     Arizona       0.0
1   2020-01-01       1  California       0.0
2   2020-01-01       1    New York       4.0
3   2020-01-01       2     Arizona       0.0
4   2020-01-01       2  California       0.0
5   2020-01-01       2    New York       0.0

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by kellygfcengineering
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