Comments on: How to use Split in Python https://www.pythonforbeginners.com/dictionary/python-split Learn By Example Mon, 10 Apr 2023 15:21:27 +0000 hourly 1 https://wordpress.org/?v=5.8.13 By: Aashish CH https://www.pythonforbeginners.com/dictionary/python-split#comment-126423227 Mon, 10 Apr 2023 15:21:27 +0000 https://www.pythonforbeginners.com/?p=814#comment-126423227 ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/pandas/core/ops/array_ops.py in _na_arithmetic_op(left, right, op, is_cmp)
165 try:
--> 166 result = func(left, right)
167 except TypeError:

/opt/conda/lib/python3.7/site-packages/pandas/core/computation/expressions.py in evaluate(op, a, b, use_numexpr)
238 # error: "None" not callable
--> 239 return _evaluate(op, op_str, a, b) # type: ignore[misc]
240 return _evaluate_standard(op, op_str, a, b)

/opt/conda/lib/python3.7/site-packages/pandas/core/computation/expressions.py in _evaluate_numexpr(op, op_str, a, b)
127 if result is None:
--> 128 result = _evaluate_standard(op, op_str, a, b)
129

/opt/conda/lib/python3.7/site-packages/pandas/core/computation/expressions.py in _evaluate_standard(op, op_str, a, b)
68 _store_test_result(False)
---> 69 return op(a, b)
70

TypeError: can only concatenate str (not "bool") to str

During handling of the above exception, another exception occurred:

TypeError Traceback (most recent call last)
/tmp/ipykernel_28/3055766754.py in <module>
2 for dataset in data_cleaner:
3 #Discrete variables
----> 4 dataset['Category'] = dataset ['business_category_name'] + dataset['is_professional_account'] + 1
5
6 dataset['private'] = 1 #initialize to yes/1 is alone

/opt/conda/lib/python3.7/site-packages/pandas/core/ops/common.py in new_method(self, other)
67 other = item_from_zerodim(other)
68
---> 69 return method(self, other)
70
71 return new_method

/opt/conda/lib/python3.7/site-packages/pandas/core/arraylike.py in __add__(self, other)
90 @unpack_zerodim_and_defer("__add__")
91 def __add__(self, other):
---> 92 return self._arith_method(other, operator.add)
93
94 @unpack_zerodim_and_defer("__radd__")

/opt/conda/lib/python3.7/site-packages/pandas/core/series.py in _arith_method(self, other, op)
5524
5525 with np.errstate(all="ignore"):
-> 5526 result = ops.arithmetic_op(lvalues, rvalues, op)
5527
5528 return self._construct_result(result, name=res_name)

/opt/conda/lib/python3.7/site-packages/pandas/core/ops/array_ops.py in arithmetic_op(left, right, op)
222 _bool_arith_check(op, left, right)
223
--> 224 res_values = _na_arithmetic_op(left, right, op)
225
226 return res_values

/opt/conda/lib/python3.7/site-packages/pandas/core/ops/array_ops.py in _na_arithmetic_op(left, right, op, is_cmp)
171 # Don't do this for comparisons, as that will handle complex numbers
172 # incorrectly, see GH#32047
--> 173 result = _masked_arith_op(left, right, op)
174 else:
175 raise

/opt/conda/lib/python3.7/site-packages/pandas/core/ops/array_ops.py in _masked_arith_op(x, y, op)
110 # See GH#5284, GH#5035, GH#19448 for historical reference
111 if mask.any():
--> 112 result[mask] = op(xrav[mask], yrav[mask])
113
114 else:

TypeError: can only concatenate str (not "bool") to str
]]>