-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TYP: Add annotation for df.pivot #32197
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
Merged
jreback
merged 41 commits into
pandas-dev:master
from
charlesdong1991:add_signature_30928
May 18, 2020
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
7e461a1
remove \n from docstring
charlesdong1991 1314059
fix conflicts
charlesdong1991 8bcb313
Merge remote-tracking branch 'upstream/master'
charlesdong1991 24c3ede
Merge remote-tracking branch 'upstream/master'
charlesdong1991 dea38f2
fix issue 17038
charlesdong1991 cd9e7ac
revert change
charlesdong1991 e5e912b
revert change
charlesdong1991 f337468
Merge remote-tracking branch 'upstream/master' into add_signature_30928
charlesdong1991 1cc1225
Add signature for pivot
charlesdong1991 046cdc9
sorting
charlesdong1991 2807b63
try fix annotation
charlesdong1991 2fdd875
fixup
charlesdong1991 5453237
fixup
charlesdong1991 18e85bb
fixup
charlesdong1991 f61dcac
fixup
charlesdong1991 5e3ac3f
fixup
charlesdong1991 ffda679
fixup
charlesdong1991 6b81abb
fixup
charlesdong1991 c01f221
fixup
charlesdong1991 1552f4b
fixup
charlesdong1991 29b0605
fixup
charlesdong1991 4d2d6d3
fixup
charlesdong1991 f7fb25a
fixup
charlesdong1991 80e9710
Merge remote-tracking branch 'upstream/master' into add_signature_30928
charlesdong1991 7618b3b
fix conflict
charlesdong1991 d44b3df
improve annotation
charlesdong1991 3c3c7a4
try out
charlesdong1991 cb6473d
fixup
charlesdong1991 6586410
Merge remote-tracking branch 'upstream/master' into add_signature_30928
charlesdong1991 76d319a
add type ignore
charlesdong1991 45637fc
add comment
charlesdong1991 62edda6
Merge remote-tracking branch 'upstream/master' into add_signature_30928
charlesdong1991 f063a24
use cast
charlesdong1991 1ac9e0f
use convert_list_like
charlesdong1991 c17dd80
commit uncommited change
charlesdong1991 16798b1
fixup
charlesdong1991 63643aa
get rid of cast
charlesdong1991 7b10761
simplify
charlesdong1991 9870d0f
fix failed test
charlesdong1991 4e05ec0
less diff
charlesdong1991 65b45a0
Merge remote-tracking branch 'upstream/master' into add_signature_30928
charlesdong1991 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
if this is a required kwarg, should the Optional be removed from the signature? cc @simonjayhawkins not sure how to handle this given that the default value is 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.
There are a few considerations here.
Optional
is normally included to represent a keyword argument that defaults to None. Sinceindex
is a keyword argument,columns
must be a keyword argument (non-default argument follows default argument). but because Label already includes None (due to an issue with Hashable) the Optional isn't actually required in this case (This is the reason to exclude Optional from aliases in general).If Optional was omitted, this could add to the confusion.
Since columns should allow None, if a column is named None.
so the default and check here should probably be _lib.no_default.
_lib.no_default currently resolves to Any (defined in cython with no stubs) so is compatible with anything.
If we typed _lib.no_default which is currently object() we wouldn't be able to type parameters precisely since object() wouldn't be compatible. In the future we may wish to define using Enums but this would add to the noise of the function signature from an end user perspective.
from https://www.python.org/dev/peps/pep-0484/#support-for-singleton-types-in-unions