_util.py 684 B

1234567891011121314151617181920212223
  1. from __future__ import annotations
  2. from pandas.compat._optional import import_optional_dependency
  3. import pandas as pd
  4. def _arrow_dtype_mapping() -> dict:
  5. pa = import_optional_dependency("pyarrow")
  6. return {
  7. pa.int8(): pd.Int8Dtype(),
  8. pa.int16(): pd.Int16Dtype(),
  9. pa.int32(): pd.Int32Dtype(),
  10. pa.int64(): pd.Int64Dtype(),
  11. pa.uint8(): pd.UInt8Dtype(),
  12. pa.uint16(): pd.UInt16Dtype(),
  13. pa.uint32(): pd.UInt32Dtype(),
  14. pa.uint64(): pd.UInt64Dtype(),
  15. pa.bool_(): pd.BooleanDtype(),
  16. pa.string(): pd.StringDtype(),
  17. pa.float32(): pd.Float32Dtype(),
  18. pa.float64(): pd.Float64Dtype(),
  19. }