I have a dataframe "bd" that looks like this:
Unnamed: 0 timestamp open high low close volume close_time quote_av trades tb_base_av tb_quote_av ignore Ticker log
0 0 17/04/2018 0.01000 0.02500 0.01000 0.02056 10026646.20 1.524010e+12 212822.90450 14612 3080879.33 65362.06898 0.0 ADABNB 0.720762
1 1 18/04/2018 0.02061 0.02227 0.02050 0.02131 6150235.16 1.524100e+12 131540.20910 8736 2932444.56 62649.93292 0.0 ADABNB 0.033400
2 2 19/04/2018 0.02126 0.02239 0.02125 0.02182 4029868.44 1.524180e+12 87958.85789 6894 1975139.34 43153.92312 0.0 ADABNB 0.026000
3 3 20/04/2018 0.02180 0.02429 0.02171 0.02400 4082134.58 1.524270e+12 94989.57750 7674 1489298.21 34675.98730 0.0 ADABNB 0.096144
4 4 21/04/2018 0.02400 0.02494 0.02031 0.02145 6363706.18 1.524360e+12 138161.60430 7733 3469179.07 74832.05245 0.0 ADABNB -0.112329
I want the "Next Day" column to only be equal to log(-1) so the next day's log returns, if the Ticker Column is the same for both days. I tried creating a new column like this:
bd['Next Day'] = np.where(bd['Ticker'] == bd[['Ticker'](-1)], bd['log'].shift(-1))
But I get an error "list" object is not callable
Thank you.
Aucun commentaire:
Enregistrer un commentaire