TypeError: Недопустимое сравнение между dtype=datetime64[ns] и датой, ПОЖАЛУЙСТА, СКАЖИТЕ, КАК ЭТО УСТРАНИТЬ
InvalidComparison Traceback (last recent call last) ~\anaconda3\lib\site-packages\pandas\core\arrays\datetimelike.py in wrapper(self, other) 115 try: --> 116 other = _validate_comparison_value(self, other) 117 except InvalidComparison:
~\anaconda3\lib\site-packages\pandas\core\arrays\datetimelike.py in _validate_comparison_value(self, other) 95 elif not is_list_like(other): ---> 96 raise InvalidComparison(other) 97
InvalidComparison: 2021-03-01
Во время обработки вышеуказанного исключения произошло другое исключение:
TypeError Traceback (последнее последнее обращение) в 30 #создайте 3m и 6m кадры данных 31 ---> 32 tx_3m = tx_data[(tx_data.InvoiceDate < date(2021,3,1)) & (tx_data.InvoiceDate >= date(2021,1,1))].reset_index(drop=True) 33 tx_6m = tx_data[(tx_data.InvoiceDate >= date(2021,3,1)) & (tx_data.InvoiceDate < date(2021,9,1))].reset_index(drop=True) 34
~\anaconda3\lib\site-packages\pandas\core\ops\common.py in new_method(self, other) 63 other = item_from_zerodim(other) 64 ---> 65 return method(self, other) 66 67 return new_method
~\anaconda3\lib\site-packages\pandas\core\ops_init_.py in wrapper(self, other) 368 rvalues = extract_array(other, extract_numpy=True) 369 --> 370 res_values = comparison_op(lvalues, rvalues, op) 371 372 return self._construct_result(res_values, name=res_name)
~\anaconda3\lib\site-packages\pandas\core\ops\array_ops.py in comparison_op(left, right, op) 228 if should_extension_dispatch(lvalues, rvalues): 229 # Вызываем метод на lvalues --> 230 res_values = op(lvalues, rvalues) 231 232 elif is_scalar(rvalues) and isna(rvalues):
~\anaconda3\lib\site-packages\pandas\core\ops\common.py in new_method(self, other) 63 other = item_from_zerodim(other) 64 ---> 65 return method(self, other) 66 67 return new_method
~\anaconda3\lib\site-packages\pandas\core\arrays\datetimelike.py in wrapper(self, other) 116 other = _validate_comparison_value(self, other) 117 except InvalidComparison: --> 118 return invalid_comparison(self, other, op) 119 120 dtype = getattr(other, "dtype", None)
~\anaconda3\lib\site-packages\pandas\core\ops\invalid.py in invalid_comparison(left, right, op) 32 else: 33 typ = type(right).name ---> 34 raise TypeError(f "Invalid comparison between dtype={left.dtype} and {typ}") 35 return res_values 36
TypeError: Недопустимое сравнение между dtype=datetime64[ns] и date