This is an automated email from the ASF dual-hosted git repository. pdallig pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push: new df5d827193 [ZEPPELIN-5920] Fix deprecation warnings (#4609) df5d827193 is described below commit df5d827193b2eab8696d11de07dcc24f2e1bf91c Author: matthias-koch <koch-matth...@web.de> AuthorDate: Wed May 31 14:42:40 2023 +0200 [ZEPPELIN-5920] Fix deprecation warnings (#4609) * [ZEPPELIN-5920] Fix deprecation warnings * [ZEPPELIN-5920] Filter deprecationWarnings only * [ZEPPELIN-5920] Replace warning supression with a counter --------- Co-authored-by: Matthias Koch <matthias-a.k...@rohde-schwarz.com> --- python/src/main/resources/python/zeppelin_context.py | 3 ++- .../zeppelin/python/BasePythonInterpreterTest.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/python/src/main/resources/python/zeppelin_context.py b/python/src/main/resources/python/zeppelin_context.py index f4cf26932c..de3807d09e 100644 --- a/python/src/main/resources/python/zeppelin_context.py +++ b/python/src/main/resources/python/zeppelin_context.py @@ -220,7 +220,8 @@ class PyZeppelinContext(object): body_buf.write("\t") body_buf.write(self.normalizeColumn(str(cell))) # don't print '\n' after the last row - if idx != (rowNumber - 1): + rowNumber -=1 + if rowNumber != 0: body_buf.write("\n") body_buf.seek(0) header_buf.seek(0) diff --git a/python/src/test/java/org/apache/zeppelin/python/BasePythonInterpreterTest.java b/python/src/test/java/org/apache/zeppelin/python/BasePythonInterpreterTest.java index 53bc364588..33f1869d3a 100644 --- a/python/src/test/java/org/apache/zeppelin/python/BasePythonInterpreterTest.java +++ b/python/src/test/java/org/apache/zeppelin/python/BasePythonInterpreterTest.java @@ -339,6 +339,25 @@ public abstract class BasePythonInterpreterTest extends ConcurrentTestCase { "%html <strong>1</strong>\t2\tb\n" + "%html <strong>2</strong>\t3\tc\n", interpreterResultMessages.get(0).getData()); + // z.show(df, show_index=True), index is timestamp + context = getInterpreterContext(); + result = interpreter.interpret("import pandas as pd\n" + + "idx = pd.date_range('20230530', periods=3, freq='D')\n" + + "df = pd.DataFrame({'name':['a','b','c']}, index= idx)\n" + + "z.show(df, show_index=True)", + context); + assertEquals(context.out.toInterpreterResultMessage().toString(), + InterpreterResult.Code.SUCCESS, result.code()); + interpreterResultMessages = context.out.toInterpreterResultMessage(); + assertEquals(1, interpreterResultMessages.size()); + assertEquals(InterpreterResult.Type.TABLE, interpreterResultMessages.get(0).getType()); + assertEquals("\tname\n" + + "%html <strong>2023-05-30T00:00:00.000000000</strong>\ta\n" + + "%html <strong>2023-05-31T00:00:00.000000000</strong>\tb\n" + + "%html <strong>2023-06-01T00:00:00.000000000</strong>\tc\n", + interpreterResultMessages.get(0).getData()); + + // z.show(matplotlib) context = getInterpreterContext(); result = interpreter.interpret("import matplotlib.pyplot as plt\n" +