-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Ex03 errors docstrings #56905
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
DOC: Ex03 errors docstrings #56905
Conversation
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.
Looks good, just there is one thing I don't fully understand, but seems like an error.
If it makes things clearer, you can check the rendered version of your changes here: https://pandas.pydata.org/preview/56905/
Maybe seeing the final result helps clarify what that variable you are changing does.
pandas/io/formats/style.py
Outdated
@@ -1968,7 +1968,7 @@ def apply_index( | |||
input_note="an index value, if an Index, or a level value of a MultiIndex", | |||
output_note="CSS styles as a string", | |||
var="v", | |||
ret='"background-color: yellow;" if v == "B" else None', | |||
ret='"background-color: yellow;" if s == "B" else None', |
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.
I don't understand this change, aren't we breaking things? Seems like the variable is indeed v
above, no? Sorry if I'm missing something.
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.
Yes, you are correct. The variable in question is indeed v
.
I had initially changed it to s
due to another error, but upon further investigation, it appears that the error has either disappeared or was simply a result of my oversight. In any case, the correct designation for now should be v
. Thank you for pointing that out!
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.
Thanks @luke396, looks great.
Uh, @datapythonista I believe the CI failure is connected to the variable we discussed earlier. It seems related to When ![]() |
I'm attempting to address it in a more sensible manner. When considering changing 's' in 'ret', which option do you think is preferable, @datapythonista? |
I think one of the tricky parts of that docstring is that it's a template reused in more than one place, so we'll have to make sure that all the resulting docstrings look good. I guess the problem may be that linting is not happy with variables with only one character. Ideally we want to understand the example, and use a variable name that is meaningful instead. If you can't find a good name, maybe something like |
The previous error doesn't appear to be solely due to using a one-character variable name. Instead, I believe it stems from the fact that in
My latest solution involves setting
If I am not mistaken, I plan to enhance the readability and precision of the variable names in the example. |
Thanks @luke396, I had a look at https://pandas.pydata.org/preview/56905/docs/reference/api/pandas.io.formats.style.Styler.apply_index.html#pandas.io.formats.style.Styler.apply_index and everything seem perfect with the variable name now. Thanks a lot for the work on this. |
* Fix exo3 and remove unused code * Remove unused in code_checks * Fix 's' to 'v' in Styler.map_index() method * Try set 's' to {var} * Use `label` for more readable variable name * Fix merge mistake * Fix merge error --------- Co-authored-by: Marc Garcia <[email protected]>
pandas.io.formats.style.Styler.map
pandas.io.formats.style.Styler.apply_index
pandas.io.formats.style.Styler.map_index
pandas.io.formats.style.Styler.format