Repository: dask/dask
Pull request: ENH Adds items to dataframe
Fixes https://github.com/dask/dask/issues/6501

- [x] Tests added / passed
- [x] Passes `black dask` / `flake8 dask`


Problem statement:
Implement DataFrame.items
DataFrame.items should return an iterator that produces the column name, series pairs:

```
In [6]: import pandas as pd

In [7]: df = pd.DataFrame({"A": [1, 2], "B": [3, 4]})

In [8]: df.items()
Out[8]: <generator object DataFrame.items at 0x11bf27970>

In [9]: for k, v in df.items():
   ...:     print(k, type(v))
   ...:
A <class 'pandas.core.series.Series'>
B <class 'pandas.core.series.Series'>
```

Hints from issue discussion:

Commit message: ENH Adds items to dataframe

Patch to review:
diff --git a/dask/dataframe/core.py b/dask/dataframe/core.py
index d94daa0147b..eca570a4af4 100644
--- a/dask/dataframe/core.py
+++ b/dask/dataframe/core.py
@@ -4148,6 +4148,11 @@ def itertuples(self, index=True, name="Pandas"):
             for row in df.itertuples(index=index, name=name):
                 yield row
 
+    @derived_from(pd.DataFrame)
+    def items(self):
+        for key in self.columns:
+            yield key, self[key]
+
     @classmethod
     def _bind_operator_method(cls, name, op, original=pd.DataFrame):
         """ bind operator method like DataFrame.add to this class """
diff --git a/dask/dataframe/tests/test_dataframe.py b/dask/dataframe/tests/test_dataframe.py
index 93c8e1d07fa..f335243a4a4 100644
--- a/dask/dataframe/tests/test_dataframe.py
+++ b/dask/dataframe/tests/test_dataframe.py
@@ -3047,6 +3047,14 @@ def test_dataframe_itertuples():
         assert a == b
 
 
+def test_dataframe_items():
+    df = pd.DataFrame({"x": [1, 2, 3, 4], "y": [10, 20, 30, 40]})
+    ddf = dd.from_pandas(df, npartitions=2)
+    for (a, b) in zip(df.items(), ddf.items()):
+        assert a[0] == b[0]  # column name
+        assert_eq(a[1], b[1].compute())  # column values
+
+
 def test_dataframe_itertuples_with_index_false():
     df = pd.DataFrame({"x": [1, 2, 3, 4], "y": [10, 20, 30, 40]})
     ddf = dd.from_pandas(df, npartitions=2)


Code review comments:
diff_hunk: @@ -4148,6 +4148,11 @@ def itertuples(self, index=True, name="Pandas"):
             for row in df.itertuples(index=index, name=name):
                 yield row
 
+    @derived_from(pd.DataFrame)
+    def items(self):
+        for key in self.columns:
+            yield key, self[key]
path: dask/dataframe/core.py
text: @user1:
Tiny comment: maybe use `label` and `content` like pandas does? 

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.items.html