U
    Y»{jô  ã                   @   st   d Z ddd„Zddd„Zdd„ Zd	d
„ Zdd„ Zdd„ Zdd„ Zddd„Zddd„Z	ddd„Z
d dd„Zdd„ ZdS )!zE
Built-in datasets for demonstration, educational and test purposes.
FNc                 C   s‚   t dƒ}|r||d |k }| r<|d  t¡d  d¡|d< |sR|jddgdd�}|r~|jtd	d
ddddddddd�
ddd� |S )a  
    Each row represents a country on a given year.

    https://www.gapminder.org/data/

    Returns:
        A `pandas.DataFrame` with 1704 rows and the following columns:
        `['country', 'continent', 'year', 'lifeExp', 'pop', 'gdpPercap',
        'iso_alpha', 'iso_num']`.
        If `datetimes` is True, the 'year' column will be a datetime column
        If `centroids` is True, two new columns are added: ['centroid_lat', 'centroid_lon']
        If `year` is an integer, the dataset will be filtered for that year
    Ú	gapminderÚyearz-01-01údatetime64[ns]Úcentroid_latÚcentroid_loné   )ÚaxisZCountryZ	ContinentZYearzLife ExpectancyzGDP per CapitaZ
PopulationzISO Alpha Country CodezISO Numeric Country CodezCentroid LatitudezCentroid Longitude)
ZcountryZ	continentr   ZlifeExpZ	gdpPercapÚpopZ	iso_alphaZiso_numr   r   ÚcolumnsT©Zmapperr   Zinplace)Ú_get_datasetÚastypeÚstrZdropÚrenameÚdict)Ú	datetimesZ	centroidsr   Úpretty_namesÚdf© r   úS/var/www/html/bwave/python/venv/lib/python3.8/site-packages/plotly/data/__init__.pyr      s2    öòr   c              
   C   s2   t dƒ}| r.|jtdddddddd	�d
dd� |S )a  
    Each row represents a restaurant bill.

    https://vincentarelbundock.github.io/Rdatasets/doc/reshape2/tips.html

    Returns:
        A `pandas.DataFrame` with 244 rows and the following columns:
        `['total_bill', 'tip', 'sex', 'smoker', 'day', 'time', 'size']`.Útipsz
Total BillZTipzPayer GenderzSmokers at TablezDay of WeekZMealz
Party Size)Z
total_billZtipZsexZsmokerÚdayÚtimeÚsizer	   Tr
   )r   r   r   )r   r   r   r   r   r   /   s     
ù	õr   c                   C   s   t dƒS )a  
    Each row represents a flower.

    https://en.wikipedia.org/wiki/Iris_flower_data_set

    Returns:
        A `pandas.DataFrame` with 150 rows and the following columns:
        `['sepal_length', 'sepal_width', 'petal_length', 'petal_width', 'species', 'species_id']`.Úiris©r   r   r   r   r   r   K   s    	r   c                   C   s   t dƒS )zä
    Each row represents a level of wind intensity in a cardinal direction, and its frequency.

    Returns:
        A `pandas.DataFrame` with 128 rows and the following columns:
        `['direction', 'strength', 'frequency']`.Úwindr   r   r   r   r   r   W   s    r   c                   C   s   t dƒS )a"  
    Each row represents voting results for an electoral district in the 2013 Montreal
    mayoral election.

    Returns:
        A `pandas.DataFrame` with 58 rows and the following columns:
        `['district', 'Coderre', 'Bergeron', 'Joly', 'total', 'winner', 'result', 'district_id']`.Úelectionr   r   r   r   r   r   a   s    r   c               	   C   sj   ddl } ddl}ddl}|j |j |j t¡¡ddd¡}|  |d¡�}| | 	¡  
d¡¡}W 5 Q R X |S )a0  
    Each feature represents an electoral district in the 2013 Montreal mayoral election.

    Returns:
        A GeoJSON-formatted `dict` with 58 polygon or multi-polygon features whose `id`
        is an electoral district numerical ID and whose `district` property is the ID and
        district name.é    NÚpackage_dataÚdatasetszelection.geojson.gzÚrzutf-8)ÚgzipÚjsonÚosÚpathÚjoinÚdirnameÚ__file__ÚGzipFileÚloadsÚreadÚdecode)r!   r"   r#   r$   ÚfÚresultr   r   r   Úelection_geojsonl   s    ür.   c                   C   s   t dƒS )a!  
    Each row represents the availability of car-sharing services near the centroid of a zone
    in Montreal over a month-long period.

    Returns:
        A `pandas.DataFrame` with 249 rows and the following columns:
        `['centroid_lat', 'centroid_lon', 'car_hours', 'peak_hour']`.Úcarsharer   r   r   r   r   r/   ƒ   s    r/   c                 C   s8   t dƒ}|r|d  d¡|d< | r4| d¡}d|j_|S )a´  
    Each row in this wide dataset represents closing prices from 6 tech stocks in 2018/2019.

    Returns:
        A `pandas.DataFrame` with 100 rows and the following columns:
        `['date', 'GOOG', 'AAPL', 'AMZN', 'FB', 'NFLX', 'MSFT']`.
        If `indexed` is True, the 'date' column is used as the index and the column index
        If `datetimes` is True, the 'date' column will be a datetime column
        is named 'company'ÚstocksÚdater   Zcompany)r   r   Ú	set_indexr	   Úname)Úindexedr   r   r   r   r   r0   Ž   s    

r0   c                 C   s   t dƒ}| rd|j_|S )a¢  
    Each row in this wide dataset represents the results of 100 simulated participants
    on three hypothetical experiments, along with their gender and control/treatment group.


    Returns:
        A `pandas.DataFrame` with 100 rows and the following columns:
        `['experiment_1', 'experiment_2', 'experiment_3', 'gender', 'group']`.
        If `indexed` is True, the data frame index is named "participant" Ú
experimentZparticipant)r   Úindexr3   ©r4   r   r   r   r   r5   ¡   s    
r5   c                 C   s"   t dƒ}| r| d¡}d|j_|S )au  
    This dataset represents the medal table for Olympic Short Track Speed Skating for the
    top three nations as of 2020.

    Returns:
        A `pandas.DataFrame` with 3 rows and the following columns:
        `['nation', 'gold', 'silver', 'bronze']`.
        If `indexed` is True, the 'nation' column is used as the index and the column index
        is named 'medal'ÚmedalsÚnationÚmedal)r   r2   r	   r3   r7   r   r   r   Úmedals_wide±   s
    

r;   c                 C   s(   t dƒjdgddd�}| r$| d¡}|S )a>  
    This dataset represents the medal table for Olympic Short Track Speed Skating for the
    top three nations as of 2020.

    Returns:
        A `pandas.DataFrame` with 9 rows and the following columns:
        `['nation', 'medal', 'count']`.
        If `indexed` is True, the 'nation' column is used as the index.r8   r9   Úcountr:   )Zid_varsZ
value_nameÚvar_name)r   Zmeltr2   r7   r   r   r   Úmedals_longÂ   s    	  ÿ
r>   c              	   C   s<   dd l }dd l}| |j |j |j t¡¡dd| d ¡¡S )Nr   r   r   z.csv.gz)Úpandasr#   Zread_csvr$   r%   r&   r'   )Údr?   r#   r   r   r   r   Ó   s    üÿr   )FFNF)F)FF)F)F)F)Ú__doc__r   r   r   r   r   r.   r/   r0   r5   r;   r>   r   r   r   r   r   Ú<module>   s   
)





