21
21
)
22
22
from pandas .compat ._optional import import_optional_dependency
23
23
24
- from pandas .core .dtypes .common import (
25
- is_categorical_dtype ,
26
- is_interval_dtype ,
27
- is_period_dtype ,
28
- is_unsigned_integer_dtype ,
29
- )
30
-
31
24
from pandas .core .arrays import ArrowExtensionArray
32
25
from pandas .core .frame import DataFrame
33
26
@@ -184,22 +177,10 @@ def to_orc(
184
177
if engine_kwargs is None :
185
178
engine_kwargs = {}
186
179
187
- # If unsupported dtypes are found raise NotImplementedError
188
- # In Pyarrow 9.0.0 this check will no longer be needed
189
- for dtype in df .dtypes :
190
- if (
191
- is_categorical_dtype (dtype )
192
- or is_interval_dtype (dtype )
193
- or is_period_dtype (dtype )
194
- or is_unsigned_integer_dtype (dtype )
195
- ):
196
- raise NotImplementedError (
197
- "The dtype of one or more columns is not supported yet."
198
- )
199
-
200
180
if engine != "pyarrow" :
201
181
raise ValueError ("engine must be 'pyarrow'" )
202
182
engine = import_optional_dependency (engine , min_version = "7.0.0" )
183
+ pa = import_optional_dependency ("pyarrow" )
203
184
orc = import_optional_dependency ("pyarrow.orc" )
204
185
205
186
was_none = path is None
@@ -214,7 +195,7 @@ def to_orc(
214
195
handles .handle ,
215
196
** engine_kwargs ,
216
197
)
217
- except TypeError as e :
198
+ except ( TypeError , pa . ArrowNotImplementedError ) as e :
218
199
raise NotImplementedError (
219
200
"The dtype of one or more columns is not supported yet."
220
201
) from e
0 commit comments