
    >ie                    \    d dl mZ d dlZd dlmZ d dlmZ 	 	 	 	 	 	 dd	Zd
 ZddZ	ddZ
dS )    )annotationsN)Version)import_required
2000-01-01
2000-01-311s1dc           
     f    ddl m} |t          t          t          t          d} |d| |||||d|S )a  Create timeseries dataframe with random data

    Parameters
    ----------
    start : datetime (or datetime-like string)
        Start of time series
    end : datetime (or datetime-like string)
        End of time series
    dtypes : dict (optional)
        Mapping of column names to types.
        Valid types include {float, int, str, 'category'}
    freq : string
        String like '2s' or '1H' or '12W' for the time series frequency
    partition_freq : string
        String like '1M' or '2Y' to divide the dataframe into partitions
    seed : int (optional)
        Randomstate seed
    kwargs:
        Keywords to pass down to individual column creation functions.
        Keywords should be prefixed by the column name and then an underscore.

    Examples
    --------
    >>> import dask
    >>> df = dask.datasets.timeseries()
    >>> df.head()  # doctest: +SKIP
              timestamp    id     name         x         y
    2000-01-01 00:00:00   967    Jerry -0.031348 -0.040633
    2000-01-01 00:00:01  1066  Michael -0.262136  0.307107
    2000-01-01 00:00:02   988    Wendy -0.526331  0.128641
    2000-01-01 00:00:03  1016   Yvonne  0.620456  0.767270
    2000-01-01 00:00:04   998   Ursula  0.684902 -0.463278
    >>> df = dask.datasets.timeseries(
    ...     '2000', '2010',
    ...     freq='2H', partition_freq='1D', seed=1,  # data frequency
    ...     dtypes={'value': float, 'name': str, 'id': int},  # data types
    ...     id_lam=1000  # control number of items in id column
    ... )
    r   )make_timeseriesN)nameidxy)startendfreqpartition_freqseeddtypes )dask.dataframe.io.demor   strintfloat)r   r   r   r   r   r   kwargsr   s           -lib/python3.11/site-packages/dask/datasets.py
timeseriesr   
   sg    ` 766666~Su5AA? %        c                    	 ddl }ddlm}m}  |dd|i  i i c}t	          |j                  t	          d          k     rdd<   nd|d<    |dd fd	i|		fd
t          |          D             S )zdGenerate data for a single partition of a dask bag

    See Also
    --------
    _make_mimesis
    r   N)FieldSchemar   z9.0.0   
iterationsschemac                                 S Nr   )fieldschema_descriptions   r   <lambda>z#_generate_mimesis.<locals>.<lambda>\   s    #5#5e#<#< r   c                6    g | ]} j         di d          S )r   r   )create).0icreate_kwargsr$   s     r   
<listcomp>z%_generate_mimesis.<locals>.<listcomp>]   s0    TTT!MFM**M**1-TTTr   r   )mimesismimesis.schemar    r!   r   __version__range)
r'   r(   records_per_partitionr   r0   r    r!   schema_kwargsr.   r$   s
   ``      @@r   _generate_mimesisr6   J   s     NNN,,,,,,,,E%%t%u%%E $&r M=w"##gg&6&666&'l##&'l#VNN<<<<<NNNFTTTTTu=R7S7STTTTr   c                   	
 ddl m} ddlm}  pi  t	          j        |          

fdt          |          D             }d | ||          z   	 	fdt          |          D             }|                    |	|          S )a  
    Make a Dask Bag filled with data randomly generated by the mimesis projet

    Parameters
    ----------
    field: dict
        keyword arguments to pass to ``mimesis.Field``
    schema: Callable[Field] -> dict
        The schema to use to generate the data
    npartitions: int
    records_per_partition: int
    seed: int, None
        Seed for random data

    Returns
    -------
    Dask Bag

    See Also
    --------
    make_people
    r   N)tokenizec                <    g | ]}                     d d          S )r   l        )randint)r,   _random_states     r   r/   z!_make_mimesis.<locals>.<listcomp>}   s)    JJJ!\!!!W--JJJr   zmimesis-c                4    i | ]\  }}|ft           |fS r   )r6   )r,   r-   r   r'   r   r4   r$   s      r   
<dictcomp>z!_make_mimesis.<locals>.<dictcomp>   s@       At 
q	%uf6KTR  r   )	dask.bagbag	dask.baser8   randomRandomr3   	enumerateBag)r'   r$   npartitionsr4   r   dbr8   seedsdskr   r<   s   `` `     @@r   _make_mimesisrJ   `   s    . """"""KRE=&&LJJJJu[7I7IJJJEv{$94  D       ''  C
 66#t[)))r   
     enc                R    t          dd           d }t          d|i|| ||          S )a  Make a dataset of random people

    This makes a Dask Bag with dictionary records of randomly generated people.
    This requires the optional library ``mimesis`` to generate records.

    Parameters
    ----------
    npartitions : int
        Number of partitions
    records_per_partition : int
        Number of records in each partition
    seed : int, (optional)
        Random seed
    locale : str
        Language locale, like 'en', 'fr', 'zh', or 'ru'

    Returns
    -------
    b: Dask Bag
    r0   zWThe mimesis module is required for this function.  Try:
  python -m pip install mimesisc           	          | d           | d           | d          f | d           | d           | d           | d          d | d	           | d
          ddS )Nz
person.agezperson.namezperson.surnamezperson.occupationzperson.telephonezaddress.addresszaddress.city)addresscityzpayment.credit_card_numberz#payment.credit_card_expiration_date)numberzexpiration-date)ager   
occupation	telephonerP   zcredit-cardr   )r'   s    r   r)   zmake_people.<locals>.<lambda>   s    u\""}%%uu-='>'>?e/00U-..$u%677~AVAVWWe899$u%JKK
 

 
 r   locale)r   rJ   )rF   r4   r   rV   r$   s        r   make_peoplerW      sO    * 	*  
 
F 	6FK1F  r   )r   r   r   r	   NNr&   )rK   rL   NrM   )
__future__r   rB   packaging.versionr   
dask.utilsr   r   r6   rJ   rW   r   r   r   <module>r[      s    " " " " " "  % % % % % % & & & & & & 		= = = =@U U U,'* '* '* '*T) ) ) ) ) )r   