python - How to isolate parts of pandas data frame -


i have json contains backtest various assets, have separated assets using following code:

preds = 'test_predictions.json'  df = pd.read_json(preds)  asset = 'poloniex_doge_btc'  grouped = df.groupby('market_trading_pair') print grouped.get_group(asset)  #each array should start , end:  #start 1446012000 #end 1452556800 

now how can truncate 'grouped' starts , ends above timestamps ?

edit:

sorry, here's example of df

  market_trading_pair  next_future_timestep_return  ohlcv_start_date  \ 7073   poloniex_doge_btc                    -0.023256        1445392800    7074   poloniex_doge_btc                     0.023810        1445396400    7075   poloniex_doge_btc                     0.000000        1445400000        prediction_at_ohlcv_end_date   7073                      0.999999   7074                      1.000000   7075                     -0.999891   

using serbitar's answer:

i replaced print grouped.get_group(asset) with:

print grouped.get_group(asset)[['ohlcv_start_date'> 1446012000 ] & ['ohlcv_start_date'< 1452556800]] 

i error

its hard judge if not have example of grouped dataframe. if x starttime , y stoptime try:

grouped[(grouped.timestamp x) & (grouped.timestmap < y)] 

you can use between function if have index on timestamps.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -