This question is related to this helpful answer here
The situation is the same. I have a dataframe:
print(df)
# A B C D
# 0 foo one 0 0
# 1 bar one 1 2
# 2 foo two 2 4
# 3 bar three 3 6
# 4 foo two 4 8
# 5 bar two 5 10
# 6 foo one 6 12
# 7 foo three 7 14
print(df.loc[df['A'] == 'foo'])
Which should give:
A B C D
0 foo one 0 0
2 foo two 2 4
4 foo two 4 8
6 foo one 6 12
7 foo three 7 14
But when I run it I get returned an empty dataframe. The column I am working with is of datatype object and looks like:
ColumnA ColumnB
117700 []
467390 []
467391 []
467392 ['AF']
467393 ['AAPL']
I have tried the following commands. All yielded the same results:
df[[ColumnB==['[AAPL]'] for ColumnB in df.ColumnA]]
df[df["ColumnB"] == "AAPL"]
df.query("ColumnB== 'AAPL'")