Repository: databricks/koalas

Issue:
Implement DataFrame.pop
Select one Series and drop it in the DataFrame in-place (see https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.pop.html?highlight=pop#pandas.DataFrame.pop)

Related to https://github.com/databricks/koalas/issues/362


Discussion:
cc @harupy and @itholic, are you interested in this?
i'm working on it
@itholic thanks!
[The pandas doc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.pop.html) says `pop` takes `str`, but it also can take a tuple of `str` when a dataframe has multi-index columns.

@HyukjinKwon 
Do you think this should be covered in docstring and tests?
That would be so nice if they are covered.

Resolving patch:
diff --git a/databricks/koalas/frame.py b/databricks/koalas/frame.py
--- a/databricks/koalas/frame.py
+++ b/databricks/koalas/frame.py
@@ -1804,6 +1804,77 @@ def transform(self, func):
 
         return DataFrame(internal)
 
+    def pop(self, item):
+        """
+        Return item and drop from frame. Raise KeyError if not found.
+        Parameters
+        ----------
+        item : str
+            Label of column to be popped.
+        Returns
+        -------
+        Series
+        Examples
+        --------
+        >>> df = ks.DataFrame([('falcon', 'bird', 389.0),
+        ...                    ('parrot', 'bird', 24.0),
+        ...                    ('lion', 'mammal', 80.5),
+        ...                    ('monkey','mammal', np.nan)],
+        ...                   columns=('name', 'class', 'max_speed'))
+        >>> df
+             name   class  max_speed
+        0  falcon    bird      389.0
+        1  parrot    bird       24.0
+        2    lion  mammal       80.5
+        3  monkey  mammal        NaN
+        >>> df.pop('class')
+        0      bird
+        1      bird
+        2    mammal
+        3    mammal
+        Name: class, dtype: object
+        >>> df
+             name  max_speed
+        0  falcon      389.0
+        1  parrot       24.0
+        2    lion       80.5
+        3  monkey        NaN
+
+        Also support for MultiIndex
+
+        >>> df = ks.DataFrame([('falcon', 'bird', 389.0),
+        ...                    ('parrot', 'bird', 24.0),
+        ...                    ('lion', 'mammal', 80.5),
+        ...                    ('monkey','mammal', np.nan)],
+        ...                   columns=('name', 'class', 'max_speed'))
+        >>> columns = [('a', 'name'), ('a', 'class'), ('b', 'max_speed')]
+        >>> df.columns = pd.MultiIndex.from_tuples(columns)
+        >>> df
+                a                 b
+             name   class max_speed
+        0  falcon    bird     389.0
+        1  parrot    bird      24.0
+        2    lion  mammal      80.5
+        3  monkey  mammal       NaN
+        >>> df.pop('a')
+             name   class
+        0  falcon    bird
+        1  parrot    bird
+        2    lion  mammal
+        3  monkey  mammal
+        >>> df
+                  b
+          max_speed
+        0     389.0
+        1      24.0
+        2      80.5
+        3       NaN
+        """
+        result = self[item]
+        self._internal = self.drop(item)._internal
+
+        return result
+
     @property
     def index(self):
         """The index (row labels) Column of the DataFrame.
@@ -4449,6 +4520,8 @@ def drop(self, labels=None, axis=1,
         0  1  7
         1  2  8
 
+        Also support for MultiIndex
+
         >>> df = ks.DataFrame({'x': [1, 2], 'y': [3, 4], 'z': [5, 6], 'w': [7, 8]},
         ...                   columns=['x', 'y', 'z', 'w'])
         >>> columns = [('a', 'x'), ('a', 'y'), ('b', 'z'), ('b', 'w')]
diff --git a/databricks/koalas/missing/frame.py b/databricks/koalas/missing/frame.py
--- a/databricks/koalas/missing/frame.py
+++ b/databricks/koalas/missing/frame.py
@@ -75,7 +75,6 @@ class _MissingPandasLikeDataFrame(object):
     mask = unsupported_function('mask')
     mode = unsupported_function('mode')
     pct_change = unsupported_function('pct_change')
-    pop = unsupported_function('pop')
     prod = unsupported_function('prod')
     product = unsupported_function('product')
     quantile = unsupported_function('quantile')


Test patch: