Repository: databricks/koalas

Issue:
Increase upper numpy version bound?
In https://github.com/databricks/koalas/pull/1734, it looks like the numpy upper bound was lowered to `<1.19.0`. Is there something in koalas that is incompatible with 1.19.x? If not, can it be increased to `<1.20.0`?

cc @ueshin 


Discussion:
Thanks for the report, @sid-kap . :)

Let me check if the tests works well on numpy `1.19.x`.

Resolving patch:
diff --git a/databricks/koalas/indexes.py b/databricks/koalas/indexes.py
--- a/databricks/koalas/indexes.py
+++ b/databricks/koalas/indexes.py
@@ -1484,6 +1484,16 @@ def delete(self, loc):
                     "index {} is out of bounds for axis 0 with size {}".format(loc, length)
                 )
             loc = [loc]
+        # pandas with numpy>=1.19.0 raises Exception if the item in the list exceeds the length.
+        # Because the behavior of `np.delete` has been changed from numpy 1.19.0
+        # which pandas uses directly.
+        elif LooseVersion(np.__version__) >= LooseVersion("1.19.0"):
+            for index in loc:
+                if abs(index) >= length:
+                    raise IndexError(
+                        "index {} is out of bounds for axis 0 with size {}".format(index, length)
+                    )
+
         loc = [int(item) for item in loc]
         loc = [item if item >= 0 else length + item for item in loc]
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -50,7 +50,7 @@
     install_requires=[
         'pandas>=0.23.2',
         'pyarrow>=0.10',
-        'numpy>=1.14,<1.19.0',
+        'numpy>=1.14',
         'matplotlib>=3.0.0,<3.3.0',
     ],
     author="Databricks",


Test patch:
diff --git a/databricks/koalas/tests/test_indexes.py b/databricks/koalas/tests/test_indexes.py
--- a/databricks/koalas/tests/test_indexes.py
+++ b/databricks/koalas/tests/test_indexes.py
@@ -794,10 +794,22 @@ def test_delete(self):
 
         self.assert_eq(pidx.delete(5).sort_values(), kidx.delete(5).sort_values())
         self.assert_eq(pidx.delete(-5).sort_values(), kidx.delete(-5).sort_values())
-        self.assert_eq(pidx.delete([0, 10000]).sort_values(), kidx.delete([0, 10000]).sort_values())
-        self.assert_eq(
-            pidx.delete([10000, 20000]).sort_values(), kidx.delete([10000, 20000]).sort_values()
-        )
+        if LooseVersion(np.__version__) >= LooseVersion("1.19.0"):
+            with self.assertRaisesRegex(
+                IndexError, "index 10000 is out of bounds for axis 0 with size 9"
+            ):
+                kidx.delete([0, 10000])
+            with self.assertRaisesRegex(
+                IndexError, "index 10000 is out of bounds for axis 0 with size 9"
+            ):
+                kidx.delete([10000, 20000])
+        else:
+            self.assert_eq(
+                pidx.delete([0, 10000]).sort_values(), kidx.delete([0, 10000]).sort_values()
+            )
+            self.assert_eq(
+                pidx.delete([10000, 20000]).sort_values(), kidx.delete([10000, 20000]).sort_values()
+            )
 
         with self.assertRaisesRegex(IndexError, "index 10 is out of bounds for axis 0 with size 9"):
             kidx.delete(10)
@@ -807,10 +819,22 @@ def test_delete(self):
 
         self.assert_eq(pidx.delete(1).sort_values(), kidx.delete(1).sort_values())
         self.assert_eq(pidx.delete(-1).sort_values(), kidx.delete(-1).sort_values())
-        self.assert_eq(pidx.delete([0, 10000]).sort_values(), kidx.delete([0, 10000]).sort_values())
-        self.assert_eq(
-            pidx.delete([10000, 20000]).sort_values(), kidx.delete([10000, 20000]).sort_values()
-        )
+        if LooseVersion(np.__version__) >= LooseVersion("1.19.0"):
+            with self.assertRaisesRegex(
+                IndexError, "index 10000 is out of bounds for axis 0 with size 3"
+            ):
+                kidx.delete([0, 10000])
+            with self.assertRaisesRegex(
+                IndexError, "index 10000 is out of bounds for axis 0 with size 3"
+            ):
+                kidx.delete([10000, 20000])
+        else:
+            self.assert_eq(
+                pidx.delete([0, 10000]).sort_values(), kidx.delete([0, 10000]).sort_values()
+            )
+            self.assert_eq(
+                pidx.delete([10000, 20000]).sort_values(), kidx.delete([10000, 20000]).sort_values()
+            )
 
     def test_append(self):
         # Index