Skip to content

Commit 73e57b0

Browse files
committed
do not catch import error when reader is not installed, return '' for empty ods cells instead of nan
1 parent 07ae596 commit 73e57b0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pandas/io/excel.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ def load_engine(self):
107107
try:
108108
self._load_engine()
109109
_readers[self.engine] = True
110-
except ImportError:
111-
_readers[self.engine] = False
112110
except AttributeError:
113111
_readers[self.engine] = False
114112
msg = 'Excel engine "%s" is not implemented' % self.engine
@@ -574,8 +572,12 @@ def _parse_cell(cell):
574572
value = cell.value
575573
elif isinstance(cell.value, bool):
576574
value = cell.value
577-
# elif isinstance(cell.value, type(None)):
578-
# value = np.nan
575+
# empty cells have None as value, type, currency, formula.
576+
# xlrd assigns empty string to empty cells, ezodf assigns None
577+
# test_excel.ExcelReaderTests.test_reader_converters expects empty
578+
# cells to be an empty string
579+
elif isinstance(cell.value, type(None)):
580+
value = ''
579581
else:
580582
value = np.nan
581583
return value

0 commit comments

Comments
 (0)