Coverage for src/ipyvizzu/data/converters/pandas/protocol.py: 100%
19 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-26 10:12 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-26 10:12 +0000
1"""
2This module provides protocol classes for pandas data frame converter.
3"""
5from typing import Any, Callable, Sequence
7from ipyvizzu.__version__ import PYENV
10if PYENV >= (3, 8):
11 from typing import Protocol, runtime_checkable
12else:
13 # TODO: remove once support for Python 3.7 is dropped
14 # pylint: disable=duplicate-code
15 from typing_extensions import Protocol, runtime_checkable # type: ignore
18@runtime_checkable
19class PandasDataFrame(Protocol):
20 """
21 Represents a pandas DataFrame Protocol.
22 """
24 # pylint: disable=too-few-public-methods
26 index: Any
27 columns: Sequence[str]
28 sample: Callable[..., Any]
29 __len__: Callable[[], int]
30 __getitem__: Callable[[Any], Any]
33@runtime_checkable
34class PandasSeries(Protocol):
35 """
36 Represents a pandas Series Protocol.
37 """
39 # pylint: disable=too-few-public-methods
41 index: Any
42 values: Any
43 dtype: Any
44 __len__: Callable[[], int]
45 __getitem__: Callable[[Any], Any]