Corrected Issue with normalized time index and updated testing#768
Corrected Issue with normalized time index and updated testing#768ablacke-ayx merged 26 commits intomasterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #768 +/- ##
==========================================
+ Coverage 97.97% 97.97% +<.01%
==========================================
Files 119 119
Lines 10772 10779 +7
==========================================
+ Hits 10554 10561 +7
Misses 218 218
Continue to review full report at Codecov.
|
| make_time_index='signup_date', | ||
| additional_variables=['signup_date'], | ||
| copy_variables=[]) | ||
| assert "signup_date" in es["customers"].df.columns |
There was a problem hiding this comment.
This line will not get hit due to the previous one raising an error
There was a problem hiding this comment.
The normalize_entity call will raise an error, which stops code execution within the with statement. If we wanted the final assert statement to be run after the error to confirm we didn't remove the signup date column, we would need to move the assert out of the with pytest.raises block
|
|
||
| for v in additional_variables: | ||
| if v == base_entity.time_index: | ||
| raise ValueError("Not moving {} as it is the base time index variable.".format(v)) |
There was a problem hiding this comment.
Let's suggest ways the user can resolve the error, either by setting make_time_index to True so it copies the base entity's time index by default, or by including the variable in copy_variables
|
|
||
| Thanks to the following people for contributing to this release: | ||
| :user:`kmax12`, :user:`rwedge` | ||
| :user:`kmax12`, :user:`rwedge`,:user:`ablacke-ayx` |
There was a problem hiding this comment.
add a space between the comma and your user tag
rwedge
left a comment
There was a problem hiding this comment.
Can you commit a version of the frequently asked questions notebook with the cell outputs cleared?
It's easier to track changes to the contents of the cells when the output is removed.
| " new_entity_id=\"sessions\",\n", | ||
| " index=\"session_id\",\n", | ||
| " make_time_index=\"session_start\",\n", | ||
| " additional_variables=[\"session_start\"])\n", |
There was a problem hiding this comment.
I think it is ok to use additional_variables here since in this example "session_start" is not the time index of the base entity
| raise ValueError("'make_time_index' must be a variable in the base entity") | ||
| elif make_time_index not in additional_variables + copy_variables: | ||
| raise ValueError("'make_time_index' must specified in 'additional_variables' or 'copy_variables'") | ||
| elif make_time_index not in copy_variables: |
There was a problem hiding this comment.
This change may prevent moving a column that is not the base entity's time index to the new entity and making it the new time index, which should be allowed
| index="customer_id", | ||
| make_time_index="join_date", | ||
| additional_variables=["zip_code", "join_date"]) | ||
| additional_variables=["zip_code","join_date"]) |
There was a problem hiding this comment.
there should be a space after the comma on this line
| additional_variables=[], | ||
| copy_variables=['cancel_date']) | ||
|
|
||
| es = copy.deepcopy(es) |
There was a problem hiding this comment.
this makes a copy of the newly modified entityset that has a cancellations entity
Pull Request Description
Fixes #750 - Stop user from removing time index from base_entity using the additional_variables
After creating the pull request: in order to pass the changelog_updated check you will need to update the "Future Release" section of
docs/source/changelog.rstto include this pull request.