-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Categorical fillna
with custom objects raises TypeError
#21097
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
Labels
Categorical
Categorical Data Type
good first issue
Missing-data
np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Regression
Functionality that used to work in a prior pandas version
Milestone
Comments
@TomAugspurger I think this might be up your alley. |
Comes from #19684 We check
In [25]: c = pd.Categorical([(0, 1), (1, 2)])
In [26]: c.fillna((0, 1))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-26-69f5393b61c6> in <module>()
----> 1 c.fillna((0, 1))
~/sandbox/pandas/pandas/util/_decorators.py in wrapper(*args, **kwargs)
175 else:
176 kwargs[new_arg_name] = new_arg_value
--> 177 return func(*args, **kwargs)
178 return wrapper
179 return _deprecate_kwarg
~/sandbox/pandas/pandas/core/arrays/categorical.py in fillna(self, value, method, limit)
1767 raise TypeError('"value" parameter must be a scalar, dict '
1768 'or Series, but you passed a '
-> 1769 '"{0}"'.format(type(value).__name__))
1770
1771 return self._constructor(values, categories=self.categories,
TypeError: "value" parameter must be a scalar, dict or Series, but you passed a "tuple" We'll need to watch out for non-hashable |
TomAugspurger
added a commit
to TomAugspurger/pandas
that referenced
this issue
May 26, 2018
jreback
pushed a commit
that referenced
this issue
May 28, 2018
jorisvandenbossche
pushed a commit
to jorisvandenbossche/pandas
that referenced
this issue
Jun 8, 2018
Closes pandas-dev#19788 Closes pandas-dev#21097 (cherry picked from commit 36c1f6b)
jorisvandenbossche
pushed a commit
that referenced
this issue
Jun 9, 2018
david-liu-brattle-1
pushed a commit
to david-liu-brattle-1/pandas
that referenced
this issue
Jun 18, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Categorical
Categorical Data Type
good first issue
Missing-data
np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Regression
Functionality that used to work in a prior pandas version
This behavior appears new in 0.23.0.
Setup copied from #21002:
I don't see any reason why passing one of the categories to
fillna
should be disallowed, so it looks like the issue is with being too strict about what qualifies as a scalar.The text was updated successfully, but these errors were encountered: