Skip to content

Commit

Permalink
Address merge comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kprestel committed Nov 3, 2018
1 parent 01866bc commit d6a09e5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pandas/_libs/parsers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ from pandas.core.dtypes.common import (
is_integer_dtype, is_float_dtype,
is_bool_dtype, is_object_dtype,
is_datetime64_dtype,
pandas_dtype)
pandas_dtype, is_extension_array_dtype,
)
from pandas.core.arrays import Categorical
from pandas.core.dtypes.concat import union_categoricals
import pandas.io.common as icom
Expand Down Expand Up @@ -1195,10 +1196,10 @@ cdef class TextReader:
na_count = 0

if result is not None and dtype != 'int64':
try:
result = result.astype(dtype)
except TypeError:
if is_extension_array_dtype(dtype):
result = result.astype(dtype.numpy_dtype)
else:
result = result.astype(dtype)

return result, na_count

Expand All @@ -1207,10 +1208,10 @@ cdef class TextReader:
na_filter, na_hashset, na_flist)

if result is not None and dtype != 'float64':
try:
result = result.astype(dtype)
except TypeError:
if is_extension_array_dtype(dtype):
result = result.astype(dtype.numpy_dtype)
else:
result = result.astype(dtype)
return result, na_count

elif is_bool_dtype(dtype):
Expand Down

0 comments on commit d6a09e5

Please sign in to comment.