Repository: pandas-dev/pandas

Issue:
DOC: Do not mention private classes in the documentation
The public documentation shouldn't mention private classes, which the users are not expected to know about, and they could be removed in the future without proper deprecation.

We've got a script to find them, it can be run with `./scripts/validate_docstrings.py --errors=GL04`

Currently there are those cases:
```
pandas.Series.pipe: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.Series.where: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.Series.mask: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.Series.first_valid_index: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.Series.last_valid_index: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.Series.tshift: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.Series.to_dense: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.core.resample.Resampler.get_group: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.DataFrame.where: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.DataFrame.mask: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.DataFrame.pipe: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.DataFrame.tshift: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.DataFrame.first_valid_index: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.DataFrame.last_valid_index: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.DataFrame.to_dense: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.core.groupby.GroupBy.get_group: Private classes (NDFrame) should not be mentioned in public docstrings
pandas.core.groupby.DataFrameGroupBy.tshift: Private classes (NDFrame) should not be mentioned in public docstrings
```

I'd say in most cases we can replace `NDFrame` by `Series or DataFrame` but may be we can rephrase sentences too.

After all them are corrected, we should add to `ci/code_checks.sh` the code `GL04` to the part where we validate the documentation, so the CI checks for it, and mentions to `NDFrame` or other private classes are not reintroduced. Also in the same PR we can add `GL05`, which is not validated but there are no errors in the code for it, so we can start validating it.


Discussion:
@datapythonista Can I take this issue?
Yes please, go for it. Thanks!

Resolving patch:
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -56,7 +56,7 @@
 # able to share
 _shared_docs = dict()
 _shared_doc_kwargs = dict(
-    axes='keywords for axes', klass='NDFrame',
+    axes='keywords for axes', klass='Series/DataFrame',
     axes_single_arg='int or labels for object',
     args_transpose='axes to permute (int or label for object)',
     optional_by="""
@@ -1940,7 +1940,7 @@ def __array_wrap__(self, result, context=None):
 
     def to_dense(self):
         """
-        Return dense representation of NDFrame (as opposed to sparse).
+        Return dense representation of Series/DataFrame (as opposed to sparse).
 
         .. deprecated:: 0.25.0
 
@@ -9036,7 +9036,7 @@ def tshift(self, periods=1, freq=None, axis=0):
 
         Returns
         -------
-        shifted : NDFrame
+        shifted : Series/DataFrame
 
         Notes
         -----
@@ -10272,12 +10272,12 @@ def _find_valid_index(self, how):
         return idx
 
     @Appender(_shared_docs['valid_index'] % {'position': 'first',
-                                             'klass': 'NDFrame'})
+                                             'klass': 'Series/DataFrame'})
     def first_valid_index(self):
         return self._find_valid_index('first')
 
     @Appender(_shared_docs['valid_index'] % {'position': 'last',
-                                             'klass': 'NDFrame'})
+                                             'klass': 'Series/DataFrame'})
     def last_valid_index(self):
         return self._find_valid_index('last')
 
diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py
--- a/pandas/core/groupby/groupby.py
+++ b/pandas/core/groupby/groupby.py
@@ -630,14 +630,14 @@ def curried(x):
 
     def get_group(self, name, obj=None):
         """
-        Construct NDFrame from group with provided name.
+        Construct DataFrame from group with provided name.
 
         Parameters
         ----------
         name : object
             the name of the group to get as a DataFrame
-        obj : NDFrame, default None
-            the NDFrame to take the DataFrame out of.  If
+        obj : DataFrame, default None
+            the DataFrame to take the DataFrame out of.  If
             it is None, the object groupby was called on will
             be used
 


Test patch: