Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.9/dist-packages/pandas/io/_util.py: 60%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

10 statements  

1from __future__ import annotations 

2 

3from typing import Callable 

4 

5from pandas.compat._optional import import_optional_dependency 

6 

7import pandas as pd 

8 

9 

10def _arrow_dtype_mapping() -> dict: 

11 pa = import_optional_dependency("pyarrow") 

12 return { 

13 pa.int8(): pd.Int8Dtype(), 

14 pa.int16(): pd.Int16Dtype(), 

15 pa.int32(): pd.Int32Dtype(), 

16 pa.int64(): pd.Int64Dtype(), 

17 pa.uint8(): pd.UInt8Dtype(), 

18 pa.uint16(): pd.UInt16Dtype(), 

19 pa.uint32(): pd.UInt32Dtype(), 

20 pa.uint64(): pd.UInt64Dtype(), 

21 pa.bool_(): pd.BooleanDtype(), 

22 pa.string(): pd.StringDtype(), 

23 pa.float32(): pd.Float32Dtype(), 

24 pa.float64(): pd.Float64Dtype(), 

25 } 

26 

27 

28def arrow_string_types_mapper() -> Callable: 

29 pa = import_optional_dependency("pyarrow") 

30 

31 return { 

32 pa.string(): pd.StringDtype(storage="pyarrow_numpy"), 

33 pa.large_string(): pd.StringDtype(storage="pyarrow_numpy"), 

34 }.get