Skip to content

Commit b3d900f

Browse files
committed
Return an unparsed sheet.
xlrd's versions of get_sheet_by_index return unparsed sheet objects which the parse function then feeds to get_sheet_data to actually turn into a DataFrame Use get_sheet_data as name of function that converts a sheet into a structure to be passed to TextParser. (To be more consistent with xlrd)
1 parent a00a7b7 commit b3d900f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pandas/io/excel/_odfreader.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ def sheet_names(self):
2929
return [t.attributes[(TABLENS, 'name')] for t in self.tables]
3030

3131
def get_sheet_by_index(self, index):
32-
return self.__get_table(self.tables[index])
32+
return self.tables[index]
3333

3434
def get_sheet_by_name(self, name):
3535
i = self.sheet_names.index(name)
36-
return self.__get_table(self.tables[i])
36+
return self.tables[i]
3737

38-
def get_sheet(self, name):
38+
def _get_sheet(self, name):
3939
"""Given a sheet name or index, return the root ODF Table node
4040
"""
4141
if isinstance(name, compat.string_types):
@@ -48,11 +48,12 @@ def get_sheet(self, name):
4848
'a string or integer'.format(type(name)))
4949

5050
def parse(self, sheet_name=0, **kwds):
51-
data = self.get_sheet(sheet_name)
51+
tree = self._get_sheet(sheet_name)
52+
data = self.get_sheet_data(tree, convert_float=False)
5253
parser = TextParser(data, **kwds)
5354
return parser.read()
5455

55-
def __get_table(self, sheet):
56+
def get_sheet_data(self, sheet, convert_float):
5657
"""Parse an ODF Table into a list of lists
5758
"""
5859
from odf.table import TableCell, TableRow

0 commit comments

Comments
 (0)