1
1
from typing import List
2
2
3
+ import numpy as np
3
4
from pandas ._typing import FilePathOrBuffer , Scalar
4
5
from pandas .compat ._optional import import_optional_dependency
5
6
@@ -149,10 +150,11 @@ def _is_empty_row(self, row) -> bool:
149
150
def _get_cell_value (self , cell , convert_float : bool ) -> Scalar :
150
151
from odf .namespaces import OFFICENS
151
152
152
- # print("cell: ", cell, convert_float)
153
+ # print("\ncell: ", cell, convert_float)
154
+ if str (cell ) == "#N/A" :
155
+ return np .nan
153
156
154
157
cell_type = cell .attributes .get ((OFFICENS , "value-type" ))
155
- cell_value = cell .attributes .get ((OFFICENS , "value" ))
156
158
# print("type=", cell_type, "value=", repr(cell_value))
157
159
if cell_type == "boolean" :
158
160
if str (cell ) == "TRUE" :
@@ -162,16 +164,11 @@ def _get_cell_value(self, cell, convert_float: bool) -> Scalar:
162
164
return self .empty_value
163
165
elif cell_type == "float" :
164
166
# GH5394
165
-
166
- value = cell .attributes .get ((OFFICENS , "value" ))
167
- if value == "" : # NA handling
168
- return ""
169
- cell_value = float (cell_value )
167
+ cell_value = float (cell .attributes .get ((OFFICENS , "value" )))
168
+ # print("value = ", value)
170
169
if convert_float :
171
- # print("convert", cell_value, int(cell_value))
172
170
val = int (cell_value )
173
171
if val == cell_value :
174
- # print("return the int")
175
172
return val
176
173
return cell_value
177
174
elif cell_type == "percentage" :
0 commit comments