From my experience, when getting data for intraday or for multiple points for a single day, time zone is required in order to plot it with a proper time.
For example: timezone_str = "America/New_York" data = yf.download(...) if not data.index.tz: data.index = data.index.tz_localize('UTC') data.index = data.index.tz_convert(timezone_str)
Otherwise graph might show trades based on UTC.
Great point, thanks for sharing.
I'll likely do a longer series on timezone information (including what a huge PITA it is), but in general I like to use the pendulum library to take care of dates and timezones. I then have a helper function to converts Pendulum's DateTime objects to Pandas timestamps (and vice versa).
Thank you for all of this, only the download link doesn't seem to work for me.
Marina, can you send me an email?
It's not a problem as your code is on Github :) and since Javascript is more habitual to me than Python, I'm doing the same here with Google Finance and spreadsheets - not much to boast about yet (https://support.google.com/docs/answer/3093281?hl=en-GB&ref_topic=3105411&sjid=7233491433172159302-EU)