Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
830fa00
add type hints
arw2019 Dec 5, 2020
605dc3c
review: remove assert
arw2019 Dec 7, 2020
e77c940
merge master
arw2019 Dec 7, 2020
f2d5ec4
typo
arw2019 Dec 7, 2020
e83904f
add isna check
arw2019 Dec 7, 2020
71caeeb
better error msg when interp method not string
arw2019 Dec 7, 2020
8fbbd47
improve docstring
arw2019 Dec 7, 2020
4474ada
Merge branch 'master' of https://github.com/pandas-dev/pandas into ty…
arw2019 Dec 7, 2020
575c227
remove Optional
arw2019 Dec 7, 2020
b19896b
use Axis TypeVar
arw2019 Dec 7, 2020
5036ee1
more hints
arw2019 Dec 8, 2020
c0c4338
Merge branch 'master' of https://github.com/pandas-dev/pandas into ty…
arw2019 Dec 8, 2020
2a31823
review comments
arw2019 Dec 9, 2020
4fb893b
Merge branch 'master' of https://github.com/pandas-dev/pandas into ty…
arw2019 Dec 9, 2020
95a734b
Merge branch 'master' of https://github.com/pandas-dev/pandas into ty…
arw2019 Dec 10, 2020
4aeec70
review comment
arw2019 Dec 10, 2020
d67977d
review comment: values_to_mask
arw2019 Dec 10, 2020
24f418a
review comments: mask_missing/infer_dtype_from_array
arw2019 Dec 11, 2020
aeb0b82
typo
arw2019 Dec 11, 2020
25d0051
typo
arw2019 Dec 11, 2020
bbd25ed
review comment
arw2019 Dec 11, 2020
785d27c
Merge branch 'master' of https://github.com/pandas-dev/pandas into ty…
arw2019 Dec 11, 2020
c2d6467
Merge branch 'master' of https://github.com/pandas-dev/pandas into ty…
arw2019 Dec 14, 2020
b505de5
review comment
arw2019 Dec 14, 2020
e39c152
docstring fix
arw2019 Dec 14, 2020
cb82c9a
review comments
arw2019 Dec 14, 2020
65effed
Merge branch 'master' of https://github.com/pandas-dev/pandas into ty…
arw2019 Dec 15, 2020
2fa64bd
Merge branch 'master' of https://github.com/pandas-dev/pandas into ty…
arw2019 Jan 5, 2021
a54a02f
merge master
arw2019 Feb 21, 2021
315822c
TYP: infer_dtype_from_array
arw2019 Feb 21, 2021
df4b70a
minimize diff
arw2019 Feb 21, 2021
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review comments: mask_missing/infer_dtype_from_array
  • Loading branch information
arw2019 committed Dec 11, 2020
commit 24f418af0df0a5a55ef0b2681fb8227f5b7715c0
6 changes: 3 additions & 3 deletions pandas/core/dtypes/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,8 @@ def dict_compat(d: Dict[Scalar, Scalar]) -> Dict[Scalar, Scalar]:


def infer_dtype_from_array(
arr: Union[ArrayLike, PandasScalar], pandas_dtype: bool = False
) -> Tuple[Dtype, ArrayLike]:
arr: Union[ArrayLike, Series, PandasScalar], pandas_dtype: bool = False
) -> Tuple[DtypeObj, Union[ArrayLike, Series]]:
"""
Infer the dtype from an array.

Expand Down Expand Up @@ -890,7 +890,7 @@ def infer_dtype_from_array(
# don't force numpy coerce with nan's
inferred = lib.infer_dtype(arr, skipna=False)
if inferred in ["string", "bytes", "mixed", "mixed-integer"]:
return (np.dtype(np.object_), arr)
return np.dtype(np.object_), arr

arr = np.asarray(arr)
return arr.dtype, arr
Expand Down
6 changes: 4 additions & 2 deletions pandas/core/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
from pandas.core.dtypes.missing import isna

if TYPE_CHECKING:
from pandas import Index
from pandas import Index, Series


def mask_missing(arr: ArrayLike, values_to_mask: ArrayLike) -> np.ndarray:
def mask_missing(
arr: ArrayLike, values_to_mask: "Union[ArrayLike, Scalar, Series]"
) -> np.ndarray:
"""
Return a masking array of same size/shape as arr
with entries equaling any member of values_to_mask set to True
Expand Down