-
-
Notifications
You must be signed in to change notification settings - Fork 155
type dataframe.transpose #1136
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
type dataframe.transpose #1136
Conversation
pandas-stubs/core/series.pyi
Outdated
| dropna: _bool = ..., | ||
| ) -> Series[float]: ... | ||
| def transpose(self, *args, **kwargs) -> Series[S1]: ... | ||
| def transpose(self, axes: None = ...) -> Series[S1]: ... |
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.
The only argument that pandas actually lets us pass at runtime is axes=None
For Series and Index, it can be passed positionally or by name
For DataFrame, it can only be passed positionally
| def transpose(self, *axes): ... | ||
| def transpose(self, *axes: Any) -> Self: ... |
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.
axes is totally ignored in SparseArray.transpose
1cd95d1 to
f752851
Compare
f752851 to
6189b5c
Compare
Dr-Irv
left a comment
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 think we need to delete transpose() from everywhere except in pandas/core/frame.pyi because only DataFrame.transpose() is documented. And even for that method, the axes argument isn't documented, so we should leave it out of the pandas stubs.
| def cumsum(self, axis: int = ..., *args, **kwargs): ... | ||
| def mean(self, axis: int = ..., *args, **kwargs): ... | ||
| def transpose(self, *axes): ... | ||
| def transpose(self, *axes: Any) -> Self: ... |
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.
We should delete this. SparseArray.transpose() is not documented. In fact, only the constructor is documented, so we should delete all the methods for SparseArray except __init__(). Can you do that here?
Dr-Irv
left a comment
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.
Need to remove the tests in test_series.py and test_indexes.py that you added for transpose there.
Dr-Irv
left a comment
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 @MarcoGorelli
assert_type()to assert the type of any return value