Skip to content

Add type hints for (DataFrame|Series)._data #26871

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 1 commit into from
Jun 16, 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
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