I tried with 1000 rows and here is the error i got:
KeyError Traceback (most recent call last)
/anaconda3/lib/python3.7/site-packages/theano/tensor/type.py in dtype_specs(self)
268 ‘complex64’: (complex, ‘theano_complex64’, ‘NPY_COMPLEX64’)
–> 269 }[self.dtype]
270 except KeyError:
KeyError: ‘object’
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
/anaconda3/lib/python3.7/site-packages/theano/tensor/basic.py in constant(x, name, ndim, dtype)
245 try:
–> 246 ttype = TensorType(dtype=x_.dtype, broadcastable=bcastable)
247 if not constant.enable:
/anaconda3/lib/python3.7/site-packages/theano/tensor/type.py in init(self, dtype, broadcastable, name, sparse_grad)
50 self.broadcastable = tuple(bool(b) for b in broadcastable)
—> 51 self.dtype_specs() # error checking is done there
52 self.name = name
/anaconda3/lib/python3.7/site-packages/theano/tensor/type.py in dtype_specs(self)
271 raise TypeError(“Unsupported dtype for %s: %s”
–> 272 % (self.class.name, self.dtype))
273
TypeError: Unsupported dtype for TensorType: object
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
/anaconda3/lib/python3.7/site-packages/theano/tensor/basic.py in as_tensor_variable(x, name, ndim)
193 try:
–> 194 return constant(x, name=name, ndim=ndim)
195 except TypeError:
/anaconda3/lib/python3.7/site-packages/theano/tensor/basic.py in constant(x, name, ndim, dtype)
265 except Exception:
–> 266 raise TypeError(“Could not convert %s to TensorType” % x, type(x))
267
TypeError: ('Could not convert [Elemwise{mul,no_inplace}.0 Elemwise{mul,no_inplace}.0\n Elemwise{mul,no_inplace}.0\n Elemwise{mul,no_inplace}.0 Elemwise{mul,no_inplace}.0\n Elemwise{mul,no_inplace}.0 Elemwise{mul,no_inplace}.0\n Elemwise{mul,no_inplace}.0
Seems like it is something wrong with the ‘object’ type for the new column added to the table, so then tried to change the data type to np.float64, then got this error:
KeyError Traceback (most recent call last)
in
15
16 # decayed promotion: pde * lam_j^{t-l}
—> 17 xxdat[‘ad’] = ((xxdat[‘pde_norm’].values) * (lam[xxdat[‘chnl_cd’].values-1]**(xxdat[‘gap_nrx_promo’].values))).astype(np.float64)
18 # Sum up of decayed promotion for each NRx + each channel: \sum_t pde * lam_j^{t-l}
19 yydat = xxdat.groupby([‘spcl_st_cd’,‘nrx_wk’, ‘chnl_cd’, ‘nrx_norm’], as_index= False).agg({‘ad’:np.sum})
/anaconda3/lib/python3.7/site-packages/theano/tensor/var.py in astype(self, dtype)
456 # CASTING
457 def astype(self, dtype):
–> 458 return theano.tensor.cast(self, dtype)
459
460 # SLICING/INDEXING
/anaconda3/lib/python3.7/site-packages/theano/tensor/basic.py in cast(x, dtype)
1264 'Casting from complex to real is ambiguous: consider real(), ’
1265 ‘imag(), angle() or abs()’))
-> 1266 return _cast_mappingdtype
1267
1268 ##########################
KeyError: <class ‘numpy.float64’>