[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.koch@rohde-schwarz.com>
diff --git a/python/src/main/resources/python/zeppelin_context.py b/python/src/main/resources/python/zeppelin_context.py
index f4cf269..de3807d 100644
--- a/python/src/main/resources/python/zeppelin_context.py
+++ b/python/src/main/resources/python/zeppelin_context.py
@@ -220,7 +220,8 @@
                 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 53bc364..33f1869 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 @@
             "%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" +