I have the following code which pulls stock data using yfinance. The output plot needs to be from the end of one trading session to the start of the next trading session, 4pm to 9:30am should be removed in the plot. How do I do this efficiently?
data = yf.download(tickers="MSFT", period="5d", interval="1m")
plt.figure(figsize=(12,8))
data['Open'].plot()