Skip to content

Commit 97b3788

Browse files
fix warning in statsforecast
1 parent 30332b6 commit 97b3788

File tree

4 files changed

+46
-74
lines changed

4 files changed

+46
-74
lines changed

Chapter5/time_series.ipynb

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,20 +2271,6 @@
22712271
"!pip install statsforecast pyspark\n"
22722272
]
22732273
},
2274-
{
2275-
"cell_type": "code",
2276-
"execution_count": 22,
2277-
"id": "da891a0f",
2278-
"metadata": {},
2279-
"outputs": [],
2280-
"source": [
2281-
"import os \n",
2282-
"\n",
2283-
"# this makes it so that the outputs of the predict methods have the id as a column \n",
2284-
"# instead of as the index\n",
2285-
"os.environ['NIXTLA_ID_AS_COL'] = '1'"
2286-
]
2287-
},
22882274
{
22892275
"cell_type": "markdown",
22902276
"id": "3d8c3905",
@@ -2304,15 +2290,26 @@
23042290
"source": [
23052291
"from pyspark.sql import SparkSession\n",
23062292
"\n",
2307-
"spark = SparkSession.builder.getOrCreate()\n"
2293+
"spark = SparkSession.builder.config(\n",
2294+
" \"spark.executorEnv.NIXTLA_ID_AS_COL\", \"1\"\n",
2295+
").getOrCreate()"
23082296
]
23092297
},
23102298
{
23112299
"cell_type": "code",
2312-
"execution_count": 31,
2300+
"execution_count": 2,
23132301
"id": "87bfec5a",
23142302
"metadata": {},
23152303
"outputs": [
2304+
{
2305+
"name": "stderr",
2306+
"output_type": "stream",
2307+
"text": [
2308+
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:27: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)\n",
2309+
" from tqdm.autonotebook import tqdm\n",
2310+
" \r"
2311+
]
2312+
},
23162313
{
23172314
"name": "stdout",
23182315
"output_type": "stream",
@@ -2349,20 +2346,15 @@
23492346
},
23502347
{
23512348
"cell_type": "code",
2352-
"execution_count": 30,
2349+
"execution_count": 3,
23532350
"id": "be012038",
23542351
"metadata": {},
23552352
"outputs": [
23562353
{
23572354
"name": "stderr",
23582355
"output_type": "stream",
23592356
"text": [
2360-
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.\n",
2361-
" warnings.warn(\n",
2362-
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.\n",
2363-
" warnings.warn(\n",
2364-
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.\n",
2365-
" warnings.warn(\n"
2357+
"[Stage 3:> (0 + 1) / 1]\r"
23662358
]
23672359
},
23682360
{
@@ -2386,10 +2378,9 @@
23862378
"name": "stderr",
23872379
"output_type": "stream",
23882380
"text": [
2389-
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.\n",
2390-
" warnings.warn(\n",
23912381
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown\n",
2392-
" warnings.warn('resource_tracker: There appear to be %d '\n"
2382+
" warnings.warn('resource_tracker: There appear to be %d '\n",
2383+
" \r"
23932384
]
23942385
}
23952386
],

docs/Chapter5/time_series.html

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,24 +1882,15 @@ <h2><span class="section-number">6.7.16. </span>Scaling Time-Series Forecasting
18821882
</div>
18831883
</details>
18841884
</div>
1885-
<div class="cell docutils container">
1886-
<div class="cell_input docutils container">
1887-
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">os</span>
1888-
1889-
<span class="c1"># this makes it so that the outputs of the predict methods have the id as a column </span>
1890-
<span class="c1"># instead of as the index</span>
1891-
<span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;NIXTLA_ID_AS_COL&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;1&#39;</span>
1892-
</pre></div>
1893-
</div>
1894-
</div>
1895-
</div>
18961885
<p>Traditional time series libraries are typically built to run in-memory on single machines, which poses challenges when handling extremely large datasets.</p>
18971886
<p>StatsForecast, however, provides seamless compatibility with Spark, allowing users to perform scalable and efficient time-series forecasting on large datasets directly within Spark.</p>
18981887
<div class="cell docutils container">
18991888
<div class="cell_input docutils container">
19001889
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pyspark.sql</span> <span class="kn">import</span> <span class="n">SparkSession</span>
19011890

1902-
<span class="n">spark</span> <span class="o">=</span> <span class="n">SparkSession</span><span class="o">.</span><span class="n">builder</span><span class="o">.</span><span class="n">getOrCreate</span><span class="p">()</span>
1891+
<span class="n">spark</span> <span class="o">=</span> <span class="n">SparkSession</span><span class="o">.</span><span class="n">builder</span><span class="o">.</span><span class="n">config</span><span class="p">(</span>
1892+
<span class="s2">&quot;spark.executorEnv.NIXTLA_ID_AS_COL&quot;</span><span class="p">,</span> <span class="s2">&quot;1&quot;</span>
1893+
<span class="p">)</span><span class="o">.</span><span class="n">getOrCreate</span><span class="p">()</span>
19031894
</pre></div>
19041895
</div>
19051896
</div>
@@ -1923,6 +1914,11 @@ <h2><span class="section-number">6.7.16. </span>Scaling Time-Series Forecasting
19231914
</div>
19241915
</div>
19251916
<div class="cell_output docutils container">
1917+
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:27: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)
1918+
from tqdm.autonotebook import tqdm
1919+
1920+
</pre></div>
1921+
</div>
19261922
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>+---------+-------------------+-------------------+
19271923
|unique_id| ds| y|
19281924
+---------+-------------------+-------------------+
@@ -1947,12 +1943,7 @@ <h2><span class="section-number">6.7.16. </span>Scaling Time-Series Forecasting
19471943
</div>
19481944
</div>
19491945
<div class="cell_output docutils container">
1950-
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.
1951-
warnings.warn(
1952-
/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.
1953-
warnings.warn(
1954-
/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.
1955-
warnings.warn(
1946+
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[Stage 3:&gt; (0 + 1) / 1]
19561947
</pre></div>
19571948
</div>
19581949
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>+---------+-------------------+----------+-------------+-------------+
@@ -1967,10 +1958,9 @@ <h2><span class="section-number">6.7.16. </span>Scaling Time-Series Forecasting
19671958
only showing top 5 rows
19681959
</pre></div>
19691960
</div>
1970-
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.
1971-
warnings.warn(
1972-
/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
1961+
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
19731962
warnings.warn(&#39;resource_tracker: There appear to be %d &#39;
1963+
19741964
</pre></div>
19751965
</div>
19761966
</div>

docs/_sources/Chapter5/time_series.ipynb

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,20 +2271,6 @@
22712271
"!pip install statsforecast pyspark\n"
22722272
]
22732273
},
2274-
{
2275-
"cell_type": "code",
2276-
"execution_count": 22,
2277-
"id": "da891a0f",
2278-
"metadata": {},
2279-
"outputs": [],
2280-
"source": [
2281-
"import os \n",
2282-
"\n",
2283-
"# this makes it so that the outputs of the predict methods have the id as a column \n",
2284-
"# instead of as the index\n",
2285-
"os.environ['NIXTLA_ID_AS_COL'] = '1'"
2286-
]
2287-
},
22882274
{
22892275
"cell_type": "markdown",
22902276
"id": "3d8c3905",
@@ -2304,15 +2290,26 @@
23042290
"source": [
23052291
"from pyspark.sql import SparkSession\n",
23062292
"\n",
2307-
"spark = SparkSession.builder.getOrCreate()\n"
2293+
"spark = SparkSession.builder.config(\n",
2294+
" \"spark.executorEnv.NIXTLA_ID_AS_COL\", \"1\"\n",
2295+
").getOrCreate()"
23082296
]
23092297
},
23102298
{
23112299
"cell_type": "code",
2312-
"execution_count": 31,
2300+
"execution_count": 2,
23132301
"id": "87bfec5a",
23142302
"metadata": {},
23152303
"outputs": [
2304+
{
2305+
"name": "stderr",
2306+
"output_type": "stream",
2307+
"text": [
2308+
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:27: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)\n",
2309+
" from tqdm.autonotebook import tqdm\n",
2310+
" \r"
2311+
]
2312+
},
23162313
{
23172314
"name": "stdout",
23182315
"output_type": "stream",
@@ -2349,20 +2346,15 @@
23492346
},
23502347
{
23512348
"cell_type": "code",
2352-
"execution_count": 30,
2349+
"execution_count": 3,
23532350
"id": "be012038",
23542351
"metadata": {},
23552352
"outputs": [
23562353
{
23572354
"name": "stderr",
23582355
"output_type": "stream",
23592356
"text": [
2360-
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.\n",
2361-
" warnings.warn(\n",
2362-
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.\n",
2363-
" warnings.warn(\n",
2364-
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.\n",
2365-
" warnings.warn(\n"
2357+
"[Stage 3:> (0 + 1) / 1]\r"
23662358
]
23672359
},
23682360
{
@@ -2386,10 +2378,9 @@
23862378
"name": "stderr",
23872379
"output_type": "stream",
23882380
"text": [
2389-
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/site-packages/statsforecast/core.py:485: FutureWarning: In a future version the predictions will have the id as a column. You can set the `NIXTLA_ID_AS_COL` environment variable to adopt the new behavior and to suppress this warning.\n",
2390-
" warnings.warn(\n",
23912381
"/Users/khuyentran/.pyenv/versions/3.8.16/lib/python3.8/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown\n",
2392-
" warnings.warn('resource_tracker: There appear to be %d '\n"
2382+
" warnings.warn('resource_tracker: There appear to be %d '\n",
2383+
" \r"
23932384
]
23942385
}
23952386
],

docs/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)