Ao tentar aplicar a função: df1[df1 > 0] = 'A' df1 (E as outras envolvendo df2 e df3) me vem o seguinte erro:
TypeError Traceback (most recent call last) in ----> 1 df1[df1 > 0] = 'A' 2 df1
~\anaconda3\lib\site-packages\pandas\core\ops_init__.py in f(self, other) 786 # straight boolean comparisons we want to allow all columns 787 # (regardless of dtype to pass thru) See #4537 for discussion. --> 788 newdata = dispatch_to_series(self, other, op) 789 return self.constructresult(new_data) 790
~\anaconda3\lib\site-packages\pandas\core\ops_init__.py in dispatchto_series(left, right, func, str_rep, axis) 376 # Get the appropriate array-op to apply to each block's values. 377 array_op = get_array_op(func, str_rep=str_rep) --> 378 bm = left.data.apply(arrayop, right=right) 379 return type(left)(bm) 380
~\anaconda3\lib\site-packages\pandas\core\internals\managers.py in apply(self, f, filter, kwargs) 438 439 if callable(f): --> 440 applied = b.apply(f, **kwargs) 441 else: 442 applied = getattr(b, f)(kwargs)
~\anaconda3\lib\site-packages\pandas\core\internals\blocks.py in apply(self, func, *kwargs) 388 """ 389 with np.errstate(all="ignore"): --> 390 result = func(self.values, *kwargs) 391 392 if is_extension_array_dtype(result) and result.ndim > 1:
~\anaconda3\lib\site-packages\pandas\core\ops\array_ops.py in comparison_op(left, right, op) 245 246 elif is_object_dtype(lvalues.dtype): --> 247 res_values = comp_method_OBJECT_ARRAY(op, lvalues, rvalues) 248 249 else:
~\anaconda3\lib\site-packages\pandas\core\ops\array_ops.py in comp_method_OBJECT_ARRAY(op, x, y) 55 result = libops.vec_compare(x.ravel(), y, op) 56 else: ---> 57 result = libops.scalar_compare(x.ravel(), y, op) 58 return result.reshape(x.shape) 59
pandas_libs\ops.pyx in pandas.libs.ops.scalarcompare()
TypeError: '>' not supported between instances of 'str' and 'int'