Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pandas-stubs/core/arrays/sparse/array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class SparseArray(ExtensionArray, ExtensionOpsMixin):
def sum(self, axis: int = ..., *args, **kwargs): ...
def cumsum(self, axis: int = ..., *args, **kwargs): ...
def mean(self, axis: int = ..., *args, **kwargs): ...
def transpose(self, *axes): ...
@property
def T(self): ...
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ...
Expand Down
1 change: 0 additions & 1 deletion pandas-stubs/core/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class SelectionMixin(Generic[NDFrameT]):

class IndexOpsMixin(OpsMixin, Generic[S1]):
__array_priority__: int = ...
def transpose(self, *args, **kwargs) -> Self: ...
@property
def T(self) -> Self: ...
@property
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
show_counts: bool | None = ...,
) -> None: ...
def memory_usage(self, index: _bool = ..., deep: _bool = ...) -> Series: ...
def transpose(self, *args, copy: _bool = ...) -> Self: ...
def transpose(self, *args: Any, copy: _bool = ...) -> Self: ...
@property
def T(self) -> Self: ...
def __getattr__(self, name: str) -> Series: ...
Expand Down
1 change: 0 additions & 1 deletion pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
bins: int | None = ...,
dropna: _bool = ...,
) -> Series[float]: ...
def transpose(self, *args, **kwargs) -> Series[S1]: ...
@property
def T(self) -> Self: ...
# The rest of these were left over from the old
Expand Down
7 changes: 7 additions & 0 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4005,6 +4005,13 @@ def test_hashable_args() -> None:
class GeoAccessor: ...


def test_transpose() -> None:
df = pd.DataFrame({"a": [1, 1, 2], "b": [4, 5, 6]})
check(assert_type(df.transpose(), pd.DataFrame), pd.DataFrame)
check(assert_type(df.transpose(None), pd.DataFrame), pd.DataFrame)
check(assert_type(df.transpose(copy=True), pd.DataFrame), pd.DataFrame)


def test_combine() -> None:
df1 = pd.DataFrame({"A": [0, 0], "B": [4, 4]})
df2 = pd.DataFrame({"A": [1, 1], "B": [3, 3]})
Expand Down