|
3 | 3 | """ |
4 | 4 | from __future__ import annotations |
5 | 5 |
|
6 | | -from typing import Mapping, Sequence, Any |
| 6 | +from typing import Mapping, Sequence, Any, TYPE_CHECKING |
7 | 7 |
|
8 | 8 | from .column_object import * |
9 | 9 | from .dataframe_object import DataFrame |
10 | 10 | from .groupby_object import * |
11 | | -from ._types import DType |
| 11 | +from .dtypes import * |
| 12 | + |
| 13 | +if TYPE_CHECKING: |
| 14 | + from ._types import DType |
12 | 15 |
|
13 | 16 | __all__ = [ |
14 | 17 | "__dataframe_api_version__", |
@@ -63,7 +66,7 @@ def concat(dataframes: Sequence[DataFrame]) -> DataFrame: |
63 | 66 | """ |
64 | 67 | ... |
65 | 68 |
|
66 | | -def column_from_sequence(sequence: Sequence[Any], *, dtype: Any, name: str = '', api_version: str | None = None) -> Column[Any]: |
| 69 | +def column_from_sequence(sequence: Sequence[Any], *, dtype: DType, name: str = '', api_version: str | None = None) -> Column: |
67 | 70 | """ |
68 | 71 | Construct Column from sequence of elements. |
69 | 72 |
|
@@ -91,7 +94,7 @@ def column_from_sequence(sequence: Sequence[Any], *, dtype: Any, name: str = '', |
91 | 94 | """ |
92 | 95 | ... |
93 | 96 |
|
94 | | -def dataframe_from_dict(data: Mapping[str, Column[Any]], *, api_version: str | None = None) -> DataFrame: |
| 97 | +def dataframe_from_dict(data: Mapping[str, Column], *, api_version: str | None = None) -> DataFrame: |
95 | 98 | """ |
96 | 99 | Construct DataFrame from map of column names to Columns. |
97 | 100 |
|
@@ -123,7 +126,7 @@ def dataframe_from_dict(data: Mapping[str, Column[Any]], *, api_version: str | N |
123 | 126 | ... |
124 | 127 |
|
125 | 128 |
|
126 | | -def column_from_1d_array(array: Any, *, dtype: Any, name: str = '', api_version: str | None = None) -> Column[Any]: |
| 129 | +def column_from_1d_array(array: Any, *, dtype: DType, name: str = '', api_version: str | None = None) -> Column: |
127 | 130 | """ |
128 | 131 | Construct Column from 1D array. |
129 | 132 |
|
@@ -232,51 +235,13 @@ def is_null(value: object, /) -> bool: |
232 | 235 |
|
233 | 236 | """ |
234 | 237 |
|
235 | | -########## |
236 | | -# Dtypes # |
237 | | -########## |
238 | | - |
239 | | -class Int64: |
240 | | - """Integer type with 64 bits of precision.""" |
241 | | - |
242 | | -class Int32: |
243 | | - """Integer type with 32 bits of precision.""" |
244 | | - |
245 | | -class Int16: |
246 | | - """Integer type with 16 bits of precision.""" |
247 | | - |
248 | | -class Int8: |
249 | | - """Integer type with 8 bits of precision.""" |
250 | | - |
251 | | -class UInt64: |
252 | | - """Unsigned integer type with 64 bits of precision.""" |
253 | | - |
254 | | -class UInt32: |
255 | | - """Unsigned integer type with 32 bits of precision.""" |
256 | | - |
257 | | -class UInt16: |
258 | | - """Unsigned integer type with 16 bits of precision.""" |
259 | | - |
260 | | -class UInt8: |
261 | | - """Unsigned integer type with 8 bits of precision.""" |
262 | | - |
263 | | -class Float64: |
264 | | - """Floating point type with 64 bits of precision.""" |
265 | | - |
266 | | -class Float32: |
267 | | - """Floating point type with 32 bits of precision.""" |
268 | | - |
269 | | -class Bool: |
270 | | - """Boolean type with 8 bits of precision.""" |
271 | | - |
272 | | - |
273 | | -def is_dtype(dtype: Any, kind: str | tuple[str, ...]) -> bool: |
| 238 | +def is_dtype(dtype: DType, kind: str | tuple[str, ...]) -> bool: |
274 | 239 | """ |
275 | 240 | Returns a boolean indicating whether a provided dtype is of a specified data type “kind”. |
276 | 241 |
|
277 | 242 | Parameters |
278 | 243 | ---------- |
279 | | - dtype: Any |
| 244 | + dtype: DType |
280 | 245 | The input dtype. |
281 | 246 | kind: str |
282 | 247 | data type kind. |
|
0 commit comments