Thanks Chartl. But it Still didn’t work. Error message:
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: Unsupported dtype for TensorType: object
Let’s just focus on one line of the code:
xxdat['ad'] = ((xxdat['pde_norm'].values) * (lam[xxdat['chnl_cd'].values-1]**(xxdat['gap_nrx_promo'].values))).astype(T.config.floatX)
I add a print function after that, and the got this table result:
<class ‘pandas.core.frame.DataFrame’>
Int64Index: 1000 entries, 1029454 to 607395
Data columns (total 8 columns):
spcl_st_cd 1000 non-null int64
nrx_wk 1000 non-null int64
nrx_norm 1000 non-null float64
chnl_cd 1000 non-null int64
promo_wk 1000 non-null int64
pde_norm 1000 non-null float64
gap_nrx_promo 1000 non-null int64
ad 1000 non-null object
dtypes: float64(2), int64(5), object(1)
memory usage: 70.3+ KB
None
So even we change the data type, the generated column is still object type. Do you know the reason for this?