Beta
Virtual Columns in pandas dataframe - Python
Loading description...
Data Frames
NumPy
Arrays
Algorithms
Data Science
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Error messages should show actual/expected values.
I added it. Thanks for the attention.
If a new table is required, this should be tested. Currently this is not tested, and modifying the input will also affect the random tests.
What does it mean? All test cases test the result of the function, which is the
new table
. Therefore, why this isn't tested? Did you said a test case to test if the input aren't changed?In this point You're right. Because I do this:
Which can be a problem because
add_virtual_column
can affect the value ofdf_expected
. Now I change the order of the statements:Now it can't affect
df_expected
. This solve the problem, did it?Marking as resolved...
Yup
The kata's requirement is ill-formed at the moment: expressions like
2
orlabel_one + 1
are perfectly valid expressions but will be rejected according to the kata's requirement because2
is being considered a label instead of a number.Make sense that
role
can be values as2
orlabel_one + 1
. But hadn't added this in the kata's requirement because it would add more complexity to te kata's. Therefore, the goal of the kata's is deal only with roles of the form:{label_one} {operation} {label_two}
. So I don't think that what you said is a problem, is only a kata's design decision.What do you think?
Marking as resolved...
Needs a test case where the dataframe contains invalid labels but
role
contains only valid labels.Actually, what is the expected handling in this case?
In this situation, the function should return an empty dataframe too. I added this assertation:
So, I think that this is solved. Thanks!
test.expect
should provide meaningful error messages.I will write it. Thanks
Error messages writed, can you check it?
Tests are using old-test-framework-style
it
blocks.But, in the codewars documentation about codewars test framework are used
describe/it
blocks. So, why this is an old style? and what is the "correct" style?That is the right link. Can you not see the difference between your code and what's written there?
The only difference is because they write the
it
block inside an function, as a decorator. I will do it, thanks!I had rewrite the tests using the convention. Can you check it?
Test framework and solution should be imported explicitly.
I don't undestand. I explicity imported the test framework, see:
Are you asking to import explicitly the solution instead of use
*
? Like this:Is it?
Sample tests aren't importing anything. And yes, don't use
import *
.Sorry. I don't have seen the error. I fixed it. Can you check?
I think this is solved.