From 7677a25376319bfc58ae0101e28b6dbebfc79950 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Mon, 3 Mar 2025 16:11:05 +0000 Subject: [PATCH 1/2] ipynb/examples/analysis_plots.ipynb: Use polars FEATURE Use polars in the example plot notebook. --- ipynb/examples/analysis_plots.ipynb | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/ipynb/examples/analysis_plots.ipynb b/ipynb/examples/analysis_plots.ipynb index d7edeec65..34a828da7 100644 --- a/ipynb/examples/analysis_plots.ipynb +++ b/ipynb/examples/analysis_plots.ipynb @@ -72,13 +72,33 @@ ")" ] }, + { + "cell_type": "markdown", + "id": "1de9251f-600c-4c4e-aaf7-9a1960911237", + "metadata": {}, + "source": [ + "# DataFrame libraries\n", + "LISA supports two dataframe (table) libraries:\n", + "* polars: https://docs.pola.rs/api/python/stable/reference/index.html\n", + "* pandas: https://pandas.pydata.org/docs/index.html\n", + "\n", + "Polars is a more modern alternative to pandas and most of the internal machinery of LISA has been moved to polars. At this point, pandas is available for backward compatibility and some internal code still has not been converted, but eventually there will not be any direct dependencies on pandas anymore. Since most dataframe-producing APIs are related to the Trace class, the switch between the two libraries can be achieved at that level:" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "abc684b9-4891-44c7-9be3-918c812be32d", + "id": "30e1c1ef-ea1e-4e65-9174-6f2f8216cb4d", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "import polars as pl\n", + "\n", + "# This creates a view of the trace that will provide polars.LazyFrame dataframes.\n", + "# It is also possible to create the trace object for polars directly with\n", + "# Trace(..., df_fmt='polars-lazyframe'). The result is the same.\n", + "trace = trace.get_view(df_fmt='polars-lazyframe')" + ] }, { "cell_type": "markdown", @@ -318,7 +338,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" + "version": "3.12.3" } }, "nbformat": 4, -- GitLab From 5c308dce46c64848f1b6243e05876894cb543d86 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Mon, 3 Mar 2025 16:16:59 +0000 Subject: [PATCH 2/2] ipynb/tests/synthetics_example.ipynb: Fix use of deprecated APIs FIX --- ipynb/tests/synthetics_example.ipynb | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/ipynb/tests/synthetics_example.ipynb b/ipynb/tests/synthetics_example.ipynb index 4d7461dcf..b0d94af51 100644 --- a/ipynb/tests/synthetics_example.ipynb +++ b/ipynb/tests/synthetics_example.ipynb @@ -5112,15 +5112,6 @@ "execution_count": 9, "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2021-07-01 17:28:40,600 WARNING : py.warnings : /tmp/ipykernel_108817/2525158218.py:1: DeprecationWarning: lisa.trace.TraceBase.df_all_events is deprecated and will be removed in version 3.0, use lisa.analysis.notebook.NotebookAnalysis.df_all_event instead: This method has been deprecated and is an alias for \"trace.ana.notebook.df_all_events()\"\n", - " bundle.trace.df_all_events()\n", - "\n" - ] - }, { "data": { "text/html": [ @@ -5223,7 +5214,7 @@ } ], "source": [ - "bundle.trace.df_all_events()" + "bundle.trace.notebook.df_all_events()" ] }, { -- GitLab