Skip to content

Commit 34bcaa8

Browse files
committed
Add types to some top-level funcs
1 parent 844dc4a commit 34bcaa8

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

pandas/core/indexes/datetimes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ def date_range(
13561356
name=None,
13571357
closed=None,
13581358
**kwargs,
1359-
):
1359+
) -> DatetimeIndex:
13601360
"""
13611361
Return a fixed frequency DatetimeIndex.
13621362
@@ -1522,7 +1522,7 @@ def bdate_range(
15221522
holidays=None,
15231523
closed=None,
15241524
**kwargs,
1525-
):
1525+
) -> DatetimeIndex:
15261526
"""
15271527
Return a fixed frequency DatetimeIndex, with business day as the default
15281528
frequency.

pandas/core/reshape/merge.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def merge(
6868
copy: bool = True,
6969
indicator: bool = False,
7070
validate=None,
71-
):
71+
) -> "DataFrame":
7272
op = _MergeOperation(
7373
left,
7474
right,
@@ -183,7 +183,7 @@ def merge_ordered(
183183
fill_method=None,
184184
suffixes=("_x", "_y"),
185185
how: str = "outer",
186-
):
186+
) -> "DataFrame":
187187
"""
188188
Perform merge with optional filling/interpolation.
189189
@@ -317,7 +317,7 @@ def merge_asof(
317317
tolerance=None,
318318
allow_exact_matches: bool = True,
319319
direction: str = "backward",
320-
):
320+
) -> "DataFrame":
321321
"""
322322
Perform an asof merge. This is similar to a left-join except that we
323323
match on nearest key rather than equal keys.

pandas/core/reshape/pivot.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def pivot_table(
3535
dropna=True,
3636
margins_name="All",
3737
observed=False,
38-
):
38+
) -> "DataFrame":
3939
index = _convert_by(index)
4040
columns = _convert_by(columns)
4141

@@ -148,7 +148,7 @@ def pivot_table(
148148
table = table.sort_index(axis=1)
149149

150150
if fill_value is not None:
151-
table = table.fillna(value=fill_value, downcast="infer")
151+
table: "DataFrame" = table.fillna(value=fill_value, downcast="infer")
152152

153153
if margins:
154154
if dropna:
@@ -426,7 +426,7 @@ def _convert_by(by):
426426

427427
@Substitution("\ndata : DataFrame")
428428
@Appender(_shared_docs["pivot"], indents=1)
429-
def pivot(data: "DataFrame", index=None, columns=None, values=None):
429+
def pivot(data: "DataFrame", index=None, columns=None, values=None) -> "DataFrame":
430430
if values is None:
431431
cols = [columns] if index is None else [index, columns]
432432
append = index is None

pandas/io/json/_normalize.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def _json_normalize(
118118
errors: Optional[str] = "raise",
119119
sep: str = ".",
120120
max_level: Optional[int] = None,
121-
):
121+
) -> "DataFrame":
122122
"""
123123
Normalize semi-structured JSON data into a flat table.
124124

pandas/util/_tester.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
"""
44
import os
55
import sys
6+
from typing import NoReturn
67

78
PKG = os.path.dirname(os.path.dirname(__file__))
89

910

10-
def test(extra_args=None):
11+
def test(extra_args=None) -> NoReturn:
1112
try:
1213
import pytest
1314
except ImportError:

0 commit comments

Comments
 (0)