Skip to content

TYP: Add return types to some top-level func #30565

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 6 commits into from
Dec 31, 2019
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
4 changes: 2 additions & 2 deletions pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ def date_range(
name=None,
closed=None,
**kwargs,
):
) -> DatetimeIndex:
"""
Return a fixed frequency DatetimeIndex.

Expand Down Expand Up @@ -1522,7 +1522,7 @@ def bdate_range(
holidays=None,
closed=None,
**kwargs,
):
) -> DatetimeIndex:
"""
Return a fixed frequency DatetimeIndex, with business day as the default
frequency.
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def merge(
copy: bool = True,
indicator: bool = False,
validate=None,
):
) -> "DataFrame":
op = _MergeOperation(
left,
right,
Expand Down Expand Up @@ -183,7 +183,7 @@ def merge_ordered(
fill_method=None,
suffixes=("_x", "_y"),
how: str = "outer",
):
) -> "DataFrame":
"""
Perform merge with optional filling/interpolation.

Expand Down Expand Up @@ -317,7 +317,7 @@ def merge_asof(
tolerance=None,
allow_exact_matches: bool = True,
direction: str = "backward",
):
) -> "DataFrame":
"""
Perform an asof merge. This is similar to a left-join except that we
match on nearest key rather than equal keys.
Expand Down
8 changes: 5 additions & 3 deletions pandas/core/reshape/pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def pivot_table(
dropna=True,
margins_name="All",
observed=False,
):
) -> "DataFrame":
index = _convert_by(index)
columns = _convert_by(columns)

Expand Down Expand Up @@ -148,7 +148,9 @@ def pivot_table(
table = table.sort_index(axis=1)

if fill_value is not None:
table = table.fillna(value=fill_value, downcast="infer")
filled = table.fillna(value=fill_value, downcast="infer")
assert filled is not None # needed for mypy
table = filled

if margins:
if dropna:
Expand Down Expand Up @@ -426,7 +428,7 @@ def _convert_by(by):

@Substitution("\ndata : DataFrame")
@Appender(_shared_docs["pivot"], indents=1)
def pivot(data: "DataFrame", index=None, columns=None, values=None):
def pivot(data: "DataFrame", index=None, columns=None, values=None) -> "DataFrame":
if values is None:
cols = [columns] if index is None else [index, columns]
append = index is None
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/json/_normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _json_normalize(
errors: Optional[str] = "raise",
sep: str = ".",
max_level: Optional[int] = None,
):
) -> "DataFrame":
"""
Normalize semi-structured JSON data into a flat table.

Expand Down