-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
reindex(fill_value=None) fills with np.NaN instead of None #14188
Comments
this is by definition |
I think it's confusing to get NaN when we give fill_value=None explicitly, without warnings or exceptions. According to reindex's document http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.reindex.html:
Perhaps we can improve the document to mention None is not a compatible value there. |
the default argument is None, meaning it's not passed this is fairly standard convention what I would take for documentation is a small section in. missing.rst to add that strings use np.nan as the missing value near the top |
I see that not supporting None here is consistent with this issue on fillna. It's true that None by default is standard in python, but it's also common to use a sentinel object (object()) when None could be meaningful. This would let us use None on both fillna and fill_value, and I think it's an improvement. What do you think? |
you could use s sentinel but we don't allow None filling for a variety of reasons |
Could you share with me some of those reasons? I've been using None in Series and DataFrames, so I'm curious about why we shouldn't. |
Thank you |
Code Sample, a copy-pastable example if possible
Expected Output
output of
pd.show_versions()
in source
This is happening in BlockManager.reindex_indexer()
https://github.com/pydata/pandas/blob/8af626474f6f314527a9ad3f15403aa2dd8c402d/pandas/core/internals.py#L3820-L3822
The text was updated successfully, but these errors were encountered: