def iter_investment(self): el_list = self.doc.xpath('//table[@class="liste"]/tbody/tr') for index, el in enumerate(el_list): try: rowspan = int(Attr(el.xpath('./td[has-class("g")]'), 'rowspan')(self)) except: continue inv = Investment() inv.label = CleanText(el.xpath('./td[has-class("i g")]'))(self.doc) inv.valuation = MyDecimal(el.xpath('./td[last()]'))(self.doc) inv._pocket_url = None for i in range(1, rowspan): # valuation is not directly written on website, but it's separated by pocket, so we compute it here, # and is also written in footer so it's sum of all valuation, not just one inv.valuation += MyDecimal(el_list[index+i].xpath('./td[last()]'))(self.doc) yield inv