def to_recarray(self): """ Transform the data dictionary to a recarray or a masked array if missing values are present. Based on input from Pierre GM. """ # First, create the descriptor: descr = [(k, self.data[k].dtype) for k in b.data.keys()] # Then, create an empty record array: ra = recarray((self.nobs, ), dtype=descr) # Then fill the recarray: [setattr(ra, n, v) for (n, v) in self.data.iteritems()] return ra
def to_recarray(self): """ Transform the data dictionary to a recarray or a masked array if missing values are present. Based on input from Pierre GM. """ # First, create the descriptor: descr = [(k,self.data[k].dtype) for k in b.data.keys()] # Then, create an empty record array: ra = recarray((self.nobs,), dtype=descr) # Then fill the recarray: [setattr(ra,n,v) for (n,v) in self.data.iteritems()] return ra