I have a Pandas dataframe in which every row is a list.
I want to search a value, but I've got an error. and I know my value exists.
I check this:
df["text list"][1] == ['رهبری']
and got:
True
then i need this:
df[df["text list"] == ['رهبری']]
and got this error:
ValueError Traceback (most recent call last)
<ipython-input-42-f14f1b2306ec> in <module>
----> 1 df[df["text list"] == ['رهبری']]
~/.local/lib/python3.6/site-packages/pandas/core/ops/__init__.py in wrapper(self, other, axis)
1205 # as it will broadcast
1206 if other.ndim != 0 and len(self) != len(other):
-> 1207 raise ValueError("Lengths must match to compare")
1208
1209 res_values = na_op(self.values, np.asarray(other))
ValueError: Lengths must match to compare
df[df["text list"] == [['رهبری']]]df[df['text list'].apply(lamda x: x == ['رهبری'])]? It's all speculating since you should provide a small example dataset where we can reproduce your error with.