We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I believe that this worked on v0.13:
df = pd.DataFrame({ 'Date':[pd.NaT, pd.Timestamp("2014-1-1")], 'Date2':[ pd.Timestamp("2013-1-1"),pd.NaT] }) In [8]: df.fillna(value={'Date':df['Date2']}) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-8-d5273c4f5a7f> in <module>() ----> 1 df.fillna(value={'Date':df['Date2']}) /usr/lib64/python2.7/site-packages/pandas/core/generic.py in fillna(self, value, method, axis, inplace, limit, downcast) 2172 continue 2173 obj = result[k] -> 2174 obj.fillna(v, inplace=True) 2175 return result 2176 else: /usr/lib64/python2.7/site-packages/pandas/core/generic.py in fillna(self, value, method, axis, inplace, limit, downcast) 2159 2160 new_data = self._data.fillna(value, inplace=inplace, -> 2161 downcast=downcast) 2162 2163 elif isinstance(value, (dict, com.ABCSeries)): /usr/lib64/python2.7/site-packages/pandas/core/internals.py in fillna(self, *args, **kwargs) 2408 2409 def fillna(self, *args, **kwargs): -> 2410 return self.apply('fillna', *args, **kwargs) 2411 2412 def downcast(self, *args, **kwargs): /usr/lib64/python2.7/site-packages/pandas/core/internals.py in apply(self, f, *args, **kwargs) 2373 2374 else: -> 2375 applied = getattr(blk, f)(*args, **kwargs) 2376 2377 if isinstance(applied, list): /usr/lib64/python2.7/site-packages/pandas/core/internals.py in fillna(self, value, inplace, downcast) 1633 values = self.values if inplace else self.values.copy() 1634 mask = com.isnull(self.values) -> 1635 value = self._try_fill(value) 1636 np.putmask(values, mask, value) 1637 return [self if inplace else /usr/lib64/python2.7/site-packages/pandas/core/internals.py in _try_fill(self, value) 1625 def _try_fill(self, value): 1626 """ if we are a NaT, return the actual fill value """ -> 1627 if isinstance(value, type(tslib.NaT)) or isnull(value): 1628 value = tslib.iNaT 1629 return value /usr/lib64/python2.7/site-packages/pandas/core/generic.py in __nonzero__(self) 674 raise ValueError("The truth value of a {0} is ambiguous. " 675 "Use a.empty, a.bool(), a.item(), a.any() or a.all()." --> 676 .format(self.__class__.__name__)) 677 678 __bool__ = __nonzero__ ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
The text was updated successfully, but these errors were encountered:
This works
In [22]: df.fillna(Timestamp('20120101')) Out[22]: Date Date2 0 2012-01-01 2013-01-01 1 2014-01-01 2012-01-01 [2 rows x 2 columns]
Sorry, something went wrong.
Okay, but I only want to fill the column labeled Date with the corresponding value from the column Date2.
AH okay. Yes, the title of the bug is not specific enough.
welcome a PR! (its an easy fix)
jreback
Successfully merging a pull request may close this issue.
I believe that this worked on v0.13:
The text was updated successfully, but these errors were encountered: