Created
December 30, 2013 19:22
-
-
Save MichaelWS/8186689 to your computer and use it in GitHub Desktop.
replace traceback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ValueError Traceback (most recent call last) | |
<ipython-input-2-b8fda0fafe55> in <module>() | |
2 ibm = web.DataReader("IBM", "yahoo", "1993/01/01").reset_index() | |
3 next_date_dict = dict(zip(ibm["Date"], ibm["Date"].shift())) | |
----> 4 ibm_next_date = ibm["Date"].replace(next_date_dict) | |
5 print (ibm_next_date == ibm["Date"]).all() | |
/local/install/pandas_test/lib/python2.7/site-packages/pandas/core/series.pyc in replace(self, to_replace, value, method, inplace, limit) | |
2838 | |
2839 if isinstance(to_replace, dict): | |
-> 2840 _rep_dict(result, to_replace) | |
2841 elif isinstance(to_replace, (list, pa.Array)): | |
2842 | |
/local/install/pandas_test/lib/python2.7/site-packages/pandas/core/series.pyc in _rep_dict(rs, to_rep) | |
2829 | |
2830 for d, m in masks.iteritems(): | |
-> 2831 com._maybe_upcast_putmask(rs.values,m,d,change=change) | |
2832 else: # if no risk of clobbering then simple | |
2833 for d, sset in dd.iteritems(): | |
/local/install/pandas_test/lib/python2.7/site-packages/pandas/core/common.pyc in _maybe_upcast_putmask(result, mask, other, dtype, change) | |
851 np.putmask(result, mask, other) | |
852 except: | |
--> 853 return changeit() | |
854 | |
855 return result, False | |
/local/install/pandas_test/lib/python2.7/site-packages/pandas/core/common.pyc in changeit() | |
815 # we are forced to change the dtype of the result as the input isn't compatible | |
816 r, fill_value = _maybe_upcast(result, fill_value=other, dtype=dtype, copy=True) | |
--> 817 np.putmask(r, mask, other) | |
818 | |
819 # we need to actually change the dtype here | |
ValueError: Invalid date (-1,-1,-1) when converting to NumPy datetime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment