Skip to content

ENH: empty() method for EA/Series/Index #23437

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
jbrockmendel opened this issue Nov 1, 2018 · 2 comments
Closed

ENH: empty() method for EA/Series/Index #23437

jbrockmendel opened this issue Nov 1, 2018 · 2 comments

Comments

@jbrockmendel
Copy link
Member

There are a few places where we need an empty array-like of the same type+dtype as self. e.g. in #23431 I used self._data[:0]. A dedicated empty() method might pretty that up.

#23431 (comment)

@gfyoung
Copy link
Member

gfyoung commented Nov 1, 2018

Reminds me a little of #549.

@nmusolino
Copy link
Contributor

I have needed something just like this for DataFrames as well.

Note that Index, Series, and DataFrame already have a Boolean .empty attribute indicating whether the object is empty.

What about a function pandas.empty_like(), or pandas.empty(), or pandas.emptied() ? Note that “empty_like” is already used by numpy for something pretty different: the numpy.empty_like function returns an array of the same shape, with uninitialized data.

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

No branches or pull requests

3 participants