Skip to content

TYP: Overload concat #41184

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
merged 15 commits into from
Aug 22, 2021
Merged
Changes from 4 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
112 changes: 98 additions & 14 deletions pandas/core/reshape/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
from pandas.core.internals import concatenate_managers

if TYPE_CHECKING:
from typing import Literal

from pandas._typing import Axis

from pandas import (
DataFrame,
Series,
Expand All @@ -57,25 +61,105 @@
@overload
def concat(
objs: Iterable[DataFrame] | Mapping[Hashable, DataFrame],
axis=0,
join: str = "outer",
ignore_index: bool = False,
keys=None,
levels=None,
names=None,
verify_integrity: bool = False,
sort: bool = False,
copy: bool = True,
axis: Literal[0, "index"] = ...,
join: str = ...,
ignore_index: bool = ...,
keys=...,
levels=...,
names=...,
verify_integrity: bool = ...,
sort: bool = ...,
copy: bool = ...,
) -> DataFrame:
...


@overload
def concat(
objs: Iterable[DataFrame] | Mapping[Hashable, DataFrame],
axis: Literal[1, "columns"],
join: str = ...,
ignore_index: bool = ...,
keys=...,
levels=...,
names=...,
verify_integrity: bool = ...,
sort: bool = ...,
copy: bool = ...,
) -> DataFrame:
...


@overload
def concat(
objs: Iterable[Series] | Mapping[Hashable, Series],
axis: Literal[0, "index"] = ...,
join: str = ...,
ignore_index: bool = ...,
keys=...,
levels=...,
names=...,
verify_integrity: bool = ...,
sort: bool = ...,
copy: bool = ...,
) -> Series:
...


@overload
def concat(
objs: Iterable[Series] | Mapping[Hashable, Series],
axis: Literal[1, "columns"],
join: str = ...,
ignore_index: bool = ...,
keys=...,
levels=...,
names=...,
verify_integrity: bool = ...,
sort: bool = ...,
copy: bool = ...,
) -> DataFrame:
...


@overload
def concat(
objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame],
axis=0,
join: str = "outer",
ignore_index: bool = False,
axis: Literal[0, "index"] = ...,
join: str = ...,
ignore_index: bool = ...,
keys=...,
levels=...,
names=...,
verify_integrity: bool = ...,
sort: bool = ...,
copy: bool = ...,
) -> DataFrame | Series:
...


@overload
def concat(
objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame],
axis: Literal[1, "columns"],
join: str = ...,
ignore_index: bool = ...,
keys=...,
levels=...,
names=...,
verify_integrity: bool = ...,
sort: bool = ...,
copy: bool = ...,
) -> DataFrame:
...


@overload
def concat(
objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame],
axis: Axis = ...,
join: str = ...,
ignore_index: bool = ...,
keys=None,
levels=None,
names=None,
Expand All @@ -89,8 +173,8 @@ def concat(
@deprecate_nonkeyword_arguments(version=None, allowed_args=["objs"])
def concat(
objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame],
axis=0,
join="outer",
axis: Axis = 0,
join: str = "outer",
ignore_index: bool = False,
keys=None,
levels=None,
Expand Down