Skip to content

Commit c54642f

Browse files
committed
WIP type for data
1 parent 691d1bb commit c54642f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pandas/_typing.py

+4
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,9 @@
3131

3232
# Type for index and columns of DataFrame
3333
Axes = Iterable[Union[ABCIndexClass, Iterable[str]]]
34+
35+
# Type for data of DataFrame
36+
Data = TypeVar("Data", ABCDataFrame, dict, np.ndarray)
37+
3438
FrameOrSeries = TypeVar("FrameOrSeries", ABCSeries, ABCDataFrame)
3539
Scalar = Union[str, int, float]

pandas/core/frame.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
)
8181
from pandas.core.dtypes.missing import isna, notna
8282

83-
from pandas._typing import Axes, Dtype
83+
from pandas._typing import Axes, Data, Dtype
8484
from pandas.core import algorithms, common as com, nanops, ops
8585
from pandas.core.accessor import CachedAccessor
8686
from pandas.core.arrays import Categorical, ExtensionArray
@@ -391,7 +391,7 @@ def _constructor_expanddim(self):
391391
# Constructors
392392

393393
def __init__(self,
394-
data=None,
394+
data: Optional[Data] = None,
395395
index: Optional[Axes] = None,
396396
columns: Optional[Axes] = None,
397397
dtype: Optional[Dtype] = None,

0 commit comments

Comments
 (0)