4
4
5
5
These should not depend on core.internals.
6
6
"""
7
- from typing import Optional , Sequence , Union , cast
7
+ from typing import TYPE_CHECKING , Any , Optional , Sequence , Union , cast
8
8
9
9
import numpy as np
10
10
import numpy .ma as ma
44
44
)
45
45
from pandas .core .dtypes .missing import isna
46
46
47
+ from pandas ._typing import ArrayLike , Dtype
47
48
import pandas .core .common as com
48
49
50
+ if TYPE_CHECKING :
51
+ from pandas .core .series import Series
52
+ from pandas .core .index import Index
53
+
49
54
50
55
def array (
51
56
data : Sequence [object ],
@@ -567,8 +572,7 @@ def _try_cast(
567
572
return subarr
568
573
569
574
570
- # see gh-17261
571
- def is_empty_data (data ):
575
+ def is_empty_data (data : Any ) -> bool :
572
576
"""
573
577
Utility to check if a Series is instantiated with empty data,
574
578
which does not contain dtype information.
@@ -589,19 +593,18 @@ def is_empty_data(data):
589
593
590
594
591
595
def create_series_with_explicit_dtype (
592
- data = None ,
593
- index = None ,
594
- dtype = None ,
595
- name = None ,
596
- copy = False ,
597
- fastpath = False ,
598
- dtype_if_empty = object ,
599
- ):
596
+ data : Any = None ,
597
+ index : Optional [ Union [ ArrayLike , Index ]] = None ,
598
+ dtype : Optional [ Dtype ] = None ,
599
+ name : Optional [ str ] = None ,
600
+ copy : bool = False ,
601
+ fastpath : bool = False ,
602
+ dtype_if_empty : Dtype = object ,
603
+ ) -> Series :
600
604
"""
601
605
Helper to pass an explicit dtype when instantiating an empty Series.
602
606
603
- This silences a DeprecationWarning described in the GitHub issue
604
- mentioned above.
607
+ This silences a DeprecationWarning described in GitHub-17261.
605
608
606
609
Parameters
607
610
----------
0 commit comments