
    LMh 
                     p    d dl mZmZ d dlmZ d dlmZ dZddiZddddd	e	d
e	dedee	         dedefdZ
dS )    )AnyOptional)Dataset)load_pandas_datasetzLoading a Huggingface dataset requires the production of exactly one DataFrame. For example, if using an Excel-based dataset, you must specify a single sheetpreserve_indexFN)pandas_kwargs	sql_query	hf_kwargshandlepathr   r	   r
   returnc                    |i n|}|i n|}t          | |||          }t          |t                    st          |t                    rt	          t
                    i t          |}t          j        |fi |S )a  Load a Kaggle Dataset into a Huggingface Dataset (via pandas)

    Args:
        handle: (string) The dataset handle
        path: (string) Path to a file within the dataset
        pandas_kwargs:
            (dict) Optional set of kwargs to pass to the pandas `read_*` method while constructing the DataFrame(s)
        sql_query:
            (string) Argument to be used for SQLite files. Required when reading a SQLite file. See pandas documentation
            for details: https://pandas.pydata.org/docs/reference/api/pandas.read_sql_query.html
        hf_kwargs:
            (dict) Optional set of kwargs to pass to Dataset.from_pandas() while constructing the Dataset
    Returns:
        Dataset
    N)r   r	   )	r   
isinstancedictlist
ValueError"MULTIPLE_DATA_FRAMES_ERROR_MESSAGEDEFAULT_PANDAS_KWARGSr   from_pandas)r   r   r   r	   r
   resultmerged_kwargss          U/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/kagglehub/hf_datasets.pyload_hf_datasetr      s    .  'YI'/BB]M ]V_```F &$ =:fd#;#; =;<<< ;,:	:Mv77777    )typingr   r   datasetsr   kagglehub.pandas_datasetsr   r   r   strr    r   r   <module>r       s                          9 9 9 9 9 9T # *51  ##8 #8 #8#8
#8 	#8
 }#8 #8 #8 #8 #8 #8 #8 #8r   