Handling Timestamp data in pandas – what’s the best index?

So when dealing with timestamp price data, particularly on a per second or per minute data basis, you're not always going to get any trades for that second or minute. Granted, you can fill in the data through pandas, but that's not my main concern.

The first column, the date/time Timestamp can be the index or you can have a separate index. It seems natural to make that timestamp data the index for the rest of your price data, but I can see where if you have times when there are no trades/transactions, it could be an issue. Having a separate index which is not a timestamp is the other possibility. Of course you can df.reindex([cols],fill_value=) either index.

Has anyone faced a similar situation dealing with their price data and what convention did you feel was most useful? Trying not to reinvent the wheel here.

Addendum: After thinking about it a bit, and realizing that time zone conversions (.tz_convert('NY/Americas')) appear to require a datetimeIndex datatype, I'm inclined to keep the timestamp the index, but would really appreciate anyone who has a different opinion.

Submitted October 18, 2020 at 08:34AM by drsxr
via https://ift.tt/31len8z

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s