-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
Comments
Hey @buckyster can I work on this ? |
Sure |
Thanks @phofl |
Hey @phofl , For DataFrame and series, I think it uses same function Do you have any idea so that I can change it without effecting the other. Please guide me here, Thanks ! |
I think I can write for both data frame and series there, any suggestions would be appreciated @phofl |
You could specify the klass through a parametrization as done in https://github.com/kadatatlukishore/pandas/blob/c1aea793e03f11b587fbda833b2f5ad06c4bbced/pandas/core/generic.py#L6122 |
@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 ! |
I don't think this works in code, only in the docs/comments |
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
https://pandas.pydata.org/docs/dev/reference/api/pandas.Series.empty.html
(And many more references to "DataFrame" instead of "Series" on that page.)
Suggested fix for documentation
Replace all mentions of "DataFrame" with "Series".
The text was updated successfully, but these errors were encountered: