DOC: sample codes should not override Python built-in functions
See original GitHub issuePandas version checks
- I have checked that the issue still exists on the latest versions of the docs on
main
here
Location of the documentation
For example, https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#transformation
Alternatively, the built-in methods could be used to produce the same outputs.
max = ts.groupby(lambda x: x.year).transform("max") min = ts.groupby(lambda x: x.year).transform("min") max - min
Documentation problem
It is not good that the user guide lists codes that override Python built-in functions.
This is the only part I happened to find, but others may exist in doc. If so, its should be revised as well.
Suggested fix for documentation
In this case, max
/min
should rename like max_ts
/min_ts
.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Built-in Functions — Python 3.11.1 documentation
When converting from a string, the string must not contain whitespace around the central + or - operator. For example, complex('1+2j') is fine, ......
Read more >Assigning to built-in function — Python Anti-Patterns ...
Unless you have a special reason, you should neither overwrite these functions nor assign a value to a variable that has the same...
Read more >Operator and Function Overloading in Custom Python Classes
The special method corresponding to it is __iadd__() . The __iadd__() method should make changes directly to the self argument and return the...
Read more >2. Built-in Functions — Python 2.7.2 documentation
The filename argument should give the file from which the code was read; ... If the object does not provide __dir__(), the function...
Read more >Overriding a Built-In Method - Python Cookbook [Book] - O'Reilly
In most cases, overriding special methods of built-in objects when you inherit from those objects (or wrap them with automatic delegation, which is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I disagree with that. Having a variable named the same as the argument name associates them with each other in my opinion
It was almost at the same time. Thank you for the follow up.