def test_pyexcel_list(): words = "pyexcel is so cool".split() result_sheet = PyexcelList(words).value_counts() result = list(result_sheet.to_array()) expected = [ ["names", "cool", "is", "pyexcel", "so"], ["counts", 1, 1, 1, 1], ] eq_(expected, result)
def row_at(self, index): """ Gets the data at the specified row """ if index in self.row_range(): return PyexcelList(copy.deepcopy(self.__array[index])) elif index < 0 and utils.abs(index) in self.row_range(): return PyexcelList( copy.deepcopy(self.__array[index + self.number_of_rows()])) else: raise IndexError(constants.MESSAGE_INDEX_OUT_OF_RANGE)
def column_at(self, index): """ Gets the data at the specified column """ cell_array = PyexcelList() if index in self.column_range(): for i in self.row_range(): cell_array.append(self.cell_value(i, index)) return cell_array elif index < 0 and utils.abs(index) in self.column_range(): reverse_index = self.number_of_columns() + index for i in self.row_range(): cell_array.append(self.cell_value(i, reverse_index)) return cell_array else: raise IndexError(constants.MESSAGE_INDEX_OUT_OF_RANGE)