Happened (optime)
OpID OpTime Val 143 2014-01-01 02:35:02 20 143 2014-01-01 02:40:01 24 143 2014-01-01 02:40 : 03 0 143 2014-01-01 02:45:01 0 143 2014-01-01 02:50:01 20 143 2014-01-01 02:55:01 143 2014-01-01 03:00:01 20 143 2014-01-01 03:05:01 24 143 2014-01-01 03:10:01 20 212 2014-01-01 02:15:01 20 212 2014-01-01 02:17:02 0 212 2014-01-31 01 02:20:01 0 212 2014-01-01 02:25:01 0 212 2014-01-01 02:30:01 20 299 2014-01-01 03:30:03 33 299 2014 -01-01 03: 35: 02 33 299 2014-01-01 03:40:01 34 299 2014-01-01 03:45:01 33 299 2014-01-01 03:45:02 34
Such a product I do not want to generate which shows only the time period in which the measurement returns zero. The starting column will show for the first time in a series of opiates, which resulted in zero, and in the end, the optimum of the first was added, which was zero to zero. .
Looking at the sample data above, I have the desired result:
OpID start ending 143 2014-01-01 02:40:03 2014-01-01 02:50 : 01 143 2014-01-01 02:55:01 2014-01-01 03: 00: 01 212 2014-01-01 02:17:02 2014-01-01 02:30:01
>Pivot () ?
How to import (= df ['wal'] == 0) DF ['weldif'] = NP Hattak ((Nain, def [DF ['zaros'].)) # Do you treat cell first? Df ['valdr'] = np.hstack ((diff (df ['zero']. Value), do you treat the last cell? Pf2 = pd.concat ([df ['zeros'] = Truth) & amp; (DF ['Waldf'] == 1)), DF [((DF ['xeros']] & amp; (DF ['welder'] == 1])]]). P.F. 2 ['AdEx 2'] = Pf2 ['opID'] + NP Ranges ['State'] = N.P.Jet (PF2 ['Zeerus'], 'Initial', 'End') (PN2), a new index for Pivot () print PF 2.pivot (index = 'idx2', column = 'state', value = 'opetime') / <> code (lane (pf2)) / 2 * 0.00000001 #
State and start idx2 143.0 2014-01-01 02:50:01 2014-01-01 02:45:01 143.1 2014-01 -01 03:00:01 2014 -01-01 02:55:01 212.2 2014-01-01 02:30:01 2014-01-01 02:25:01
to PO3 = PD DataFrame (PF 2.pivot (index = 'idx2', column = 'state', value = 'opetime')) PF3. Index = asarray (pf3.index.values, 'int')
Comments
Post a Comment