stefan-jansen / machine-learning-for-trading

Code for Machine Learning for Algorithmic Trading, 2nd edition.
https://ml4trading.io
12.87k stars 4.11k forks source link

Chapter 2: Working with Order Book Data: NASDAQ ITCH #236

Closed djkamm closed 2 years ago

djkamm commented 2 years ago

When attempting to run the code:

buy_per_min.timestamp = buy_per_min.timestamp.add(utc_offset).astype(int)

I get the error TypeError: cannot astype a datetimelike from [datetime64[ns]] to [int32]

Help!

djkamm commented 2 years ago

I figured it out. Replace astype(int) with astype(np.int64)

stefan-jansen commented 2 years ago

Glad to hear.