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
Make sure index variable comes first #168
Conversation
@@ -22,6 +22,11 @@ def test_is_index_column(es): | |||
assert es['cohorts'].index == 'cohort' | |||
|
|||
|
|||
def test_index_at_beginning(es): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add another test?
I'm thinking create an entity from a DF where the index isn't the first column and make sure that it gets moved to be be the first in the variables list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense, I'll add that too
# make sure index is at the beginning | ||
index_variable = [v for v in self.variables | ||
if v.id == self.index][0] | ||
self.variables = [index_variable] + [v for v in self.variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we not care if the order of variables doesn't match the underlying dataframe? I don't believe we assume that anywhere. can you think of any places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we reorder the columns in the dataframe as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya, let's do that
Codecov Report
@@ Coverage Diff @@
## master #168 +/- ##
==========================================
+ Coverage 92.88% 92.89% +0.01%
==========================================
Files 70 70
Lines 7486 7506 +20
==========================================
+ Hits 6953 6973 +20
Misses 533 533
Continue to review full report at Codecov.
|
Looks good, merging |
Reorders variable list in
Entity.__init__()
so that the index variable is at the front of the list.