def __setitem__(self,key,value):
        """Emulate __setitem__ method
        probably it is not that fast."""
        
        try:
            self.table[key]=value
        except KeyError,e:
            if type(key)==tuple:
                if len(key)==2:
                    try:
                        rowix=self.rownames.index(key[0])
                        self.table[key[1]][rowix]=value
                    except:
                        raise Exception("Reference error")
                elif len(key)==1:
                    try:
                        rowix=self.rownames.index(key[0])
                    except ValueError:
                        raise Exception("No such a row or column name exists, %s" %key[0])
                    
                    try:
                        for col,val in itertools.izip(self.colnames,value): self.table[col][rowix]=val
                    except TypeError:
                        raise Exception("Value must be iterable and have the same length as each row has")
                else:
                    raise KeyError, e
dataset/ETHPy150Open taoliu/taolib/Assoc/inout.py/DataFrame.__setitem__/original