QuantSoftware / QuantSoftwareToolkit

QuantSoftwareToolkit
Other
467 stars 215 forks source link

FutureWarning: TimeSeries broadcasting along DataFrame index by default is deprecated #60

Open ler opened 9 years ago

ler commented 9 years ago

I am seeing this warning message when using QSTK 0.2.8 with pandas 0.14.1 on Ubuntu (I suspect there is some version sensitivity at work here.)

The message led me to believe my old event study code would still work however I was detecting over 200K events where only a few 100s were expected. After modifying my code to eliminate the broadcasting I was still getting the warning for qstkstudy/EventProfiler.py

I found that line 35: df_rets = df_rets - df_rets[s_market_sym]

needed to be changed to: df_rets = df_rets.sub(df_rets[s_market_sym], axis=0)

The broadcasting change is explained in pandas docs http://pandas.pydata.org/pandas-docs/stable/dsintro.html?highlight=broadcasting#data-alignment-and-arithmetic and the pink "Warning" box there describes exactly this case.