---

title: Tourism dataset


keywords: fastai
sidebar: home_sidebar

summary: "Download the Tourism dataset."
description: "Download the Tourism dataset."
nb_path: "nbs/data_datasets__tourism.ipynb"
---
<!--

#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: nbs/data_datasets__tourism.ipynb
# command to build the docs after a change: nbdev_build_docs

-->

<div class="container" id="notebook-container">
        
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Tourism meta information</p>

</div>
</div>
</div>
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="Yearly" class="doc_header"><code>class</code> <code>Yearly</code><a href="https://github.com/Nixtla/nixtlats/tree/master/nixtlats/data/datasets/tourism.py#L18" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>Yearly</code>(<strong><code>seasonality</code></strong>:<code>int</code>=<em><code>1</code></em>, <strong><code>horizon</code></strong>:<code>int</code>=<em><code>4</code></em>, <strong><code>freq</code></strong>:<code>str</code>=<em><code>'Y'</code></em>, <strong><code>rows</code></strong>:<code>int</code>=<em><code>2</code></em>, <strong><code>name</code></strong>:<code>str</code>=<em><code>'Yearly'</code></em>, <strong><code>n_ts</code></strong>:<code>int</code>=<em><code>518</code></em>)</p>
</blockquote>
<p>Yearly(seasonality: int = 1, horizon: int = 4, freq: str = 'Y', rows: int = 2, name: str = 'Yearly', n_ts: int = 518)</p>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="Quarterly" class="doc_header"><code>class</code> <code>Quarterly</code><a href="https://github.com/Nixtla/nixtlats/tree/master/nixtlats/data/datasets/tourism.py#L27" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>Quarterly</code>(<strong><code>seasonality</code></strong>:<code>int</code>=<em><code>4</code></em>, <strong><code>horizon</code></strong>:<code>int</code>=<em><code>8</code></em>, <strong><code>freq</code></strong>:<code>str</code>=<em><code>'Q'</code></em>, <strong><code>rows</code></strong>:<code>int</code>=<em><code>3</code></em>, <strong><code>name</code></strong>:<code>str</code>=<em><code>'Quarterly'</code></em>, <strong><code>n_ts</code></strong>:<code>int</code>=<em><code>427</code></em>)</p>
</blockquote>
<p>Quarterly(seasonality: int = 4, horizon: int = 8, freq: str = 'Q', rows: int = 3, name: str = 'Quarterly', n_ts: int = 427)</p>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="Monthly" class="doc_header"><code>class</code> <code>Monthly</code><a href="https://github.com/Nixtla/nixtlats/tree/master/nixtlats/data/datasets/tourism.py#L36" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>Monthly</code>(<strong><code>seasonality</code></strong>:<code>int</code>=<em><code>12</code></em>, <strong><code>horizon</code></strong>:<code>int</code>=<em><code>24</code></em>, <strong><code>freq</code></strong>:<code>str</code>=<em><code>'M'</code></em>, <strong><code>rows</code></strong>:<code>int</code>=<em><code>3</code></em>, <strong><code>name</code></strong>:<code>str</code>=<em><code>'Monthly'</code></em>, <strong><code>n_ts</code></strong>:<code>int</code>=<em><code>366</code></em>)</p>
</blockquote>
<p>Monthly(seasonality: int = 12, horizon: int = 24, freq: str = 'M', rows: int = 3, name: str = 'Monthly', n_ts: int = 366)</p>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="Tourism" class="doc_header"><code>class</code> <code>Tourism</code><a href="https://github.com/Nixtla/nixtlats/tree/master/nixtlats/data/datasets/tourism.py#L49" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>Tourism</code>(<strong><code>S</code></strong>:<code>DataFrame</code>, <strong><code>X</code></strong>:<code>DataFrame</code>, <strong><code>Y</code></strong>:<code>DataFrame</code>, <strong><code>idx_categorical_static</code></strong>:<code>Optional</code>[<code>List</code>[<code>T</code>]]=<em><code>None</code></em>, <strong><code>group</code></strong>:<code>Union</code>[<code>str</code>, <code>List</code>[<code>str</code>]]=<em><code>None</code></em>) :: <a href="/nixtlats/data_datasets__utils.html#TimeSeriesDataclass"><code>TimeSeriesDataclass</code></a></p>
</blockquote>
<p>Args:
    S (pd.DataFrame): DataFrame of static features of shape
        (n_time_series, n_features).
    X (pd.DataFrame): DataFrame of exogenous variables of shape
        (sum n_periods_i for i=1..n_time_series, n_exogenous).
    Y (pd.DataFrame): DataFrame of target variable of shape
        (sum n_periods_i for i=1..n_time_series, 1).
    idx_categorical_static (list, optional): List of categorical indexes
        of S.
    group (str, optional): Group name if applies.
        Example: 'Yearly'</p>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">
<div class="input">

<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">for</span> <span class="n">group</span><span class="p">,</span> <span class="n">meta</span> <span class="ow">in</span> <span class="n">TourismInfo</span><span class="p">:</span>
    <span class="n">data</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span> <span class="o">=</span> <span class="n">Tourism</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">directory</span><span class="o">=</span><span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="n">group</span><span class="o">=</span><span class="n">group</span><span class="p">)</span>
    <span class="n">unique_elements</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">groupby</span><span class="p">([</span><span class="s1">&#39;unique_id&#39;</span><span class="p">,</span> <span class="s1">&#39;ds&#39;</span><span class="p">])</span><span class="o">.</span><span class="n">size</span><span class="p">()</span>
    <span class="n">unique_ts</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">groupby</span><span class="p">(</span><span class="s1">&#39;unique_id&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">size</span><span class="p">()</span>

    <span class="k">assert</span> <span class="p">(</span><span class="n">unique_elements</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">sum</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">,</span> <span class="sa">f</span><span class="s1">&#39;Duplicated records found: </span><span class="si">{</span><span class="n">group</span><span class="si">}</span><span class="s1">&#39;</span>
    <span class="k">assert</span> <span class="n">unique_ts</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">meta</span><span class="o">.</span><span class="n">n_ts</span><span class="p">,</span> <span class="sa">f</span><span class="s1">&#39;Number of time series not match: </span><span class="si">{</span><span class="n">group</span><span class="si">}</span><span class="s1">&#39;</span>
</pre></div>

    </div>
</div>
</div>

<div class="output_wrapper">
<div class="output">

<div class="output_area">

<div class="output_subarea output_stream output_stderr output_text">
<pre>100%|██████████| 356k/356k [00:00&lt;00:00, 1.74MiB/s]
INFO:nixtla.data.datasets.utils:Successfully downloaded 27-3-Athanasopoulos1.zip, 356334, bytes.
INFO:nixtla.data.datasets.utils:Successfully decompressed data/tourism/datasets/27-3-Athanasopoulos1.zip
</pre>
</div>
</div>

</div>
</div>

</div>
    {% endraw %}

</div>
 

