One reason for getting a 404 error is that your stock ticker is not valid. Also, yfinance will give you the 404 error if you hit their rate limit by making too many requests in a time period.