6
6
"""
7
7
from __future__ import annotations
8
8
9
- from dataclasses import dataclass
10
9
from typing import (
10
+ TYPE_CHECKING ,
11
11
Any ,
12
12
List ,
13
13
Literal ,
14
+ Mapping ,
14
15
Optional ,
16
+ Protocol ,
15
17
Sequence ,
16
18
Tuple ,
17
19
TypeVar ,
18
20
Union ,
19
- Protocol ,
20
21
)
21
- from enum import Enum
22
+
23
+ if TYPE_CHECKING :
24
+ from .dataframe_object import DataFrame
22
25
23
26
# Type alias: Mypy needs Any, but for readability we need to make clear this
24
27
# is a Python scalar (i.e., an instance of `bool`, `int`, `float`, `str`, etc.)
@@ -48,6 +51,100 @@ def __len__(self, /) -> int:
48
51
...
49
52
50
53
54
+ class Namespace (Protocol ):
55
+ __dataframe_api_version__ : str
56
+
57
+ class DataFrame :
58
+ ...
59
+
60
+ class Column :
61
+ ...
62
+
63
+ class Int64 :
64
+ ...
65
+
66
+ class Int32 :
67
+ ...
68
+
69
+ class Int16 :
70
+ ...
71
+
72
+ class Int8 :
73
+ ...
74
+
75
+ class UInt64 :
76
+ ...
77
+
78
+ class UInt32 :
79
+ ...
80
+
81
+ class UInt16 :
82
+ ...
83
+
84
+ class UInt8 :
85
+ ...
86
+
87
+ class Float64 :
88
+ ...
89
+
90
+ class Float32 :
91
+ ...
92
+
93
+ class Bool :
94
+ ...
95
+
96
+ @staticmethod
97
+ def concat (dataframes : Sequence [DataFrame ]) -> DataFrame :
98
+ ...
99
+
100
+ @staticmethod
101
+ def column_from_sequence (
102
+ sequence : Sequence [Any ],
103
+ * ,
104
+ dtype : Any ,
105
+ name : str = "" ,
106
+ api_version : str | None = None ,
107
+ ) -> Column :
108
+ ...
109
+
110
+ @staticmethod
111
+ def dataframe_from_dict (
112
+ data : Mapping [str , Column ], * , api_version : str | None = None
113
+ ) -> DataFrame :
114
+ ...
115
+
116
+ @staticmethod
117
+ def column_from_1d_array (
118
+ array : Any , * , dtype : Any , name : str = "" , api_version : str | None = None
119
+ ) -> Column :
120
+ ...
121
+
122
+ @staticmethod
123
+ def dataframe_from_2d_array (
124
+ array : Any ,
125
+ * ,
126
+ names : Sequence [str ],
127
+ dtypes : Mapping [str , Any ],
128
+ api_version : str | None = None ,
129
+ ) -> DataFrame :
130
+ ...
131
+
132
+ @staticmethod
133
+ def is_null (value : object , / ) -> bool :
134
+ ...
135
+
136
+ @staticmethod
137
+ def is_dtype (dtype : Any , kind : str | tuple [str , ...]) -> bool :
138
+ ...
139
+
140
+
141
+ class SupportsDataFrameAPI (Protocol ):
142
+ def __dataframe_consortium_standard__ (
143
+ self , * , api_version : str | None = None
144
+ ) -> DataFrame :
145
+ ...
146
+
147
+
51
148
__all__ = [
52
149
"Any" ,
53
150
"DataFrame" ,
@@ -65,5 +162,4 @@ def __len__(self, /) -> int:
65
162
"device" ,
66
163
"DType" ,
67
164
"ellipsis" ,
68
- "Enum" ,
69
165
]
0 commit comments