You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the docs stipulate that only int, str and dict are allowed for the fill_value, yet it seems like all the types that could be used when creating a DataFrame 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:
File "/Users/loic/Documents/Code/pandas-stubs/gh1214_unstack/.venv/lib/python3.13/site-packages/pandas/core/reshape/reshape.py", line 238, in get_result
values, _ = self.get_new_values(values, fill_value)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/Users/loic/Documents/Code/pandas-stubs/gh1214_unstack/.venv/lib/python3.13/site-packages/pandas/core/reshape/reshape.py", line 288, in get_new_values
dtype, fill_value = maybe_promote(dtype, fill_value)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/Users/loic/Documents/Code/pandas-stubs/gh1214_unstack/.venv/lib/python3.13/site-packages/pandas/core/dtypes/cast.py", line 595, in maybe_promote
dtype, fill_value = _maybe_promote(dtype, fill_value)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/Users/loic/Documents/Code/pandas-stubs/gh1214_unstack/.venv/lib/python3.13/site-packages/pandas/core/dtypes/cast.py", line 622, in _maybe_promote
raise ValueError("fill_value must be a scalar")
ValueError: fill_value must be a scalar
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: