Skip to content

DOC: description for Series.empty is referencing DataFrames instead of Series #42697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
buckyster opened this issue Jul 24, 2021 · 8 comments · Fixed by #44430
Closed

DOC: description for Series.empty is referencing DataFrames instead of Series #42697

buckyster opened this issue Jul 24, 2021 · 8 comments · Fixed by #44430
Labels
Docs Series Series data structure
Milestone

Comments

@buckyster
Copy link

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/series.html
https://pandas.pydata.org/docs/dev/reference/api/pandas.Series.empty.html

Documentation problem

The description about Series.empty are referencing DataFrames instead of Series:

https://pandas.pydata.org/docs/dev/reference/series.html

Series.empty | Indicator whether DataFrame is empty.

https://pandas.pydata.org/docs/dev/reference/api/pandas.Series.empty.html

True if DataFrame is entirely empty (no items), meaning any of the axes are of length 0.

(And many more references to "DataFrame" instead of "Series" on that page.)

Suggested fix for documentation

Replace all mentions of "DataFrame" with "Series".

@buckyster buckyster added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 24, 2021
@kadatatlukishore
Copy link
Contributor

Hey @buckyster can I work on this ?

@phofl
Copy link
Member

phofl commented Jul 24, 2021

Sure

@phofl phofl added Series Series data structure and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 24, 2021
@kadatatlukishore
Copy link
Contributor

Thanks @phofl

@kadatatlukishore
Copy link
Contributor

kadatatlukishore commented Jul 25, 2021

@kadatatlukishore
Copy link
Contributor

I think I can write for both data frame and series there, any suggestions would be appreciated @phofl

@phofl
Copy link
Member

phofl commented Jul 25, 2021

@kadatatlukishore
Copy link
Contributor

kadatatlukishore commented Jul 25, 2021

    @property
    @doc(**_shared_doc_kwargs)
    def empty(self: FrameOrSeries) -> bool_t:
        """
        Indicator whether {klass} is empty.

        True if {klass} is entirely empty (no items), meaning any of the
        axes are of length 0.

        Returns
        -------
        bool
            If {klass} is empty, return True, if not return False.

        See Also
        --------
        Series.dropna : Return series without null values.
        DataFrame.dropna : Return DataFrame with labels on given axis omitted
            where (all or any) data are missing.

        Notes
        -----
        If {klass} contains only NaNs, it is still not considered empty. See
        the example below.

        Examples
        --------
        An example of an actual empty {klass}. Notice the index is empty:

        >>> df_empty = pd.{klass}({'A' : []})
        >>> df_empty
        Empty {klass}
        Columns: [A]
        Index: []
        >>> df_empty.empty
        True

        If we only have NaNs in our {klass}, it is not considered empty! We
        will need to drop the NaNs to make the {klass} empty:

        >>> df = pd.{klass}({'A' : [np.nan]})
        >>> df
            A
        0 NaN
        >>> df.empty
        False
        >>> df.dropna().empty
        True
        """
        return any(len(self._get_axis(a)) == 0 for a in self._AXIS_ORDERS)

Like this @phofl , sorry I am a newbie so never encounter like this before. Thanks for guiding me !

@phofl
Copy link
Member

phofl commented Jul 25, 2021

I don't think this works in code, only in the docs/comments
The best thing is if you generate the docs, then you can view and adjust them accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Series Series data structure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants