I have two pandas dataframes, both with datetime indices; sample output:
l1_with_nonlimiting_trace_gas_df.index:
DatetimeIndex(['2018-03-25 11:13:41+00:00', '2018-03-25 11:17:40+00:00',
'2018-03-25 11:21:38+00:00', '2018-03-25 11:25:23+00:00',
'2018-03-25 11:29:03+00:00', '2018-03-25 11:34:06+00:00',
'2018-03-25 11:37:47+00:00', '2018-03-25 11:48:48+00:00',
'2018-03-25 11:59:23+00:00', '2018-03-25 12:08:32+00:00',
...
'2018-03-25 22:31:00+00:00', '2018-03-25 22:45:34+00:00',
'2018-03-25 22:55:34+00:00', '2018-03-25 23:04:55+00:00',
'2018-03-25 23:12:44+00:00', '2018-03-25 23:16:38+00:00',
'2018-03-25 23:20:38+00:00', '2018-03-25 23:24:33+00:00',
'2018-03-25 23:28:32+00:00', '2018-03-25 23:33:36+00:00'],
dtype='datetime64[ns, UTC]', length=124, freq=None)
l1_with_limiting_trace_gas_df.index:
DatetimeIndex(['2018-03-25 11:11:38+00:00', '2018-03-25 11:15:39+00:00',
'2018-03-25 11:19:38+00:00', '2018-03-25 11:23:27+00:00',
'2018-03-25 11:27:11+00:00', '2018-03-25 11:32:21+00:00',
'2018-03-25 11:35:55+00:00', '2018-03-25 11:40:09+00:00',
'2018-03-25 11:49:39+00:00', '2018-03-25 12:00:05+00:00',
...
'2018-03-25 22:46:17+00:00', '2018-03-25 22:56:26+00:00',
'2018-03-25 23:05:53+00:00', '2018-03-25 23:10:49+00:00',
'2018-03-25 23:14:42+00:00', '2018-03-25 23:18:42+00:00',
'2018-03-25 23:22:36+00:00', '2018-03-25 23:26:31+00:00',
'2018-03-25 23:31:33+00:00', '2018-03-25 23:35:34+00:00'],
dtype='datetime64[ns, UTC]', length=130, freq=None)
When I do the get_loc operation:
index_location=l1_with_nonlimiting_trace_gas_df.index.get_loc(l1_with_limiting_trace_gas_df.index[i],method='nearest')
I get the ufunc error: UFuncTypeError: ufunc 'subtract' cannot use operands with types dtype('<M8[ns]') and dtype('O')
That used to work in the past. Now it no longer works. Here are my versions:
pd.version Out[152]: '1.0.1'
np.version Out[154]: '1.18.1'
Some help here would be greatly appreciated.