-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Series(index=[]) should have dtype=object #49574
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
BUG: Series(index=[]) should have dtype=object #49574
Conversation
b75bfe9
to
cf220db
Compare
The failed check looks unrelated. |
@@ -511,7 +511,10 @@ def _init_dict( | |||
elif index is not None: | |||
# fastpath for Series(data=None). Just use broadcasting a scalar | |||
# instead of reindexing. | |||
values = na_value_for_dtype(pandas_dtype(dtype), compat=False) | |||
if len(index) or dtype is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know that index
is list-like by the time we get here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, partly from the type hints in this method and partly because of the index = ensure_index(index)
part in the __init__
method.
Thanks for catching this. One question otherwise LGTM |
Thanks @topper-123 |
* BUG: Series(index=[]) should have dtype=object * parametrize tests * accept dtype * fix Co-authored-by: Terji Petersen <[email protected]>
* BUG: Series(index=[]) should have dtype=object * parametrize tests * accept dtype * fix Co-authored-by: Terji Petersen <[email protected]>
* BUG: Series(index=[]) should have dtype=object * parametrize tests * accept dtype * fix Co-authored-by: Terji Petersen <[email protected]>
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.No doc entry is needed, because this only fixes a corner case of #49342.