When trying to run a FamaMacBeth
regression on my dataset, I get the TypeError
:
cannot astype a datetimelike from [datetime64[ns]] to [float64],
My date column is of type numpy.ndarray
Anyone know what I am doing wrong?
When trying to run a FamaMacBeth
regression on my dataset, I get the TypeError
:
cannot astype a datetimelike from [datetime64[ns]] to [float64],
My date column is of type numpy.ndarray
Anyone know what I am doing wrong?
This is a known issue:
The problem is that we don't support the datetime64[s] type on pandas objects, even though it's a valid type for NumPy arrays.
A possible workaround is converting directly to float, as in the comment on this question: