class_docstr: Yahoo Finance connector for retrieving stock data.
class_docstr_tok: ["Yahoo","Finance","connector","for","retrieving","stock","data","."]
code: def __init__(
      self,
      stock_ticker: Optional[str] = None,
      config: Optional[Union[YahooFinanceConnectorConfig, dict]] = None,
      cache_interval: int = 600,
  ):
      if not stock_ticker and not config:
          raise ValueError(
              "You must specify either a stock ticker or a config object."
          )
  
      try:
          import yfinance
      except ImportError as e:
          raise ImportError(
              "Could not import yfinance python package. "
              "Please install it with `pip install yfinance`."
          ) from e
  
      if not isinstance(config, YahooFinanceConnectorConfig):
          if not config:
              config = {}
  
          if stock_ticker:
              config["table"] = stock_ticker
  
          yahoo_finance_config = YahooFinanceConnectorConfig(**config)
      else:
          yahoo_finance_config = config
  
      self._cache_interval = cache_interval
      super().__init__(yahoo_finance_config)
      self.ticker = yfinance.Ticker(self._config.table)
  
file_path: pandas-ai/pandasai/connectors/yahoo_finance.py
imports: import os
  import pandas
  from typing import Optional, Union
  from .base import YahooFinanceConnectorConfig, BaseConnector
  import time
  from ..helpers.path import find_project_root
  from ..constants import DEFAULT_FILE_PERMISSIONS
  import hashlib
label_desc: Use image node_id 1 to create a new YahooFinanceConnector object from inherited base classes: BaseConnector with example: obj = YahooFinanceConnector(stock_ticker, config, cache_interval)