-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: DataFrame.unstack should accept fill_value with more types than just int/str/dict #61445
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
1 task done
Comments
Also I realized that the pd.DataFrame([
["a", "b", pd.Timestamp(2021, 3, 2)],
["a", "a", pd.Timestamp(2023, 4, 2)],
["b", "b", pd.Timestamp(2024, 3, 2)]
]).set_index([0, 1]).unstack(1, fill_value={2: pd.Timestamp(2023, 4, 5)})
|
FWIW, I didn't see any tests for Seems like the doc change was part of this PR #28655 and it was just erroneous to document the |
take |
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pandas version checks
main
hereLocation of the documentation
https://pandas.pydata.org/docs/dev/reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack
Documentation problem
Currently the docs stipulate that only
int
,str
anddict
are allowed for thefill_value
, yet it seems like all the types that could be used when creating aDataFrame
seem to pass at runtime. I have not tried them all yet but int, float, complex, timestamp are working fine.Suggested fix for documentation
Add all allowed types for dataframe elements for the
fill_value
field.Happy to create the PR if this is agreed by the maintainers. I will raise the issue in the pandas-stubs repo.
The text was updated successfully, but these errors were encountered: