Skip to content

Commit

Permalink
Add type hints for (NDFrame|Series)._data (pandas-dev#26871)
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 authored and jreback committed Jun 16, 2019
1 parent 2115bf3 commit 3381c64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import operator
import pickle
from textwrap import dedent
from typing import Callable, FrozenSet, List, Set
from typing import Callable, FrozenSet, List, Optional, Set
import warnings
import weakref

Expand Down Expand Up @@ -35,6 +35,7 @@
from pandas.core.dtypes.missing import isna, notna

import pandas as pd
from pandas._typing import Dtype
from pandas.core import missing, nanops
import pandas.core.algorithms as algos
from pandas.core.base import PandasObject, SelectionMixin
Expand Down Expand Up @@ -118,12 +119,17 @@ class NDFrame(PandasObject, SelectionMixin):
]) # type: FrozenSet[str]
_metadata = [] # type: List[str]
_is_copy = None
_data = None # type: BlockManager

# ----------------------------------------------------------------------
# Constructors

def __init__(self, data, axes=None, copy=False, dtype=None,
fastpath=False):
def __init__(self,
data: BlockManager,
axes: Optional[List[Index]] = None,
copy: bool = False,
dtype: Optional[Dtype] = None,
fastpath: bool = False):

if not fastpath:
if dtype is not None:
Expand Down
1 change: 1 addition & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
# Override cache_readonly bc Series is mutable
hasnans = property(base.IndexOpsMixin.hasnans.func,
doc=base.IndexOpsMixin.hasnans.__doc__)
_data = None # type: SingleBlockManager

# ----------------------------------------------------------------------
# Constructors
Expand Down

0 comments on commit 3381c64

Please sign in to comment.