Series replace values using timestamps in a dict · Issue #5797 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
I was working with financial data and was replacing dates that were not valid trading days. It seems that replace does not work on any dict between two timestamps. Here is an example. This simply throws an exception on 0.12.
import pandas.io.data as web
ibm = web.DataReader("IBM", "yahoo", "1993/01/01").reset_index()
next_date_dict = dict(zip(ibm["Date"], ibm["Date"].shift()))
ibm_next_date = ibm["Date"].replace(next_date_dict)
print (ibm_next_date == ibm["Date"]).all()
in 0.12 there is an exception:
https://gist.github.com/MichaelWS/8186689