Why the SQL query written in Pandas returned empty DataFrame although the SQL query is right?

68 views Asked by At

I'm trying to get a list of movies from Steven Spielberg, but for some reason the query in Pandas returns an empty DataFrame, although I know for sure that the table contains Steven Spielberg movies.

enter image description here

Before writing code in Pandas, I imported everything:

from pandasql import sqldf
pysqldf = lambda q: sqldf(q, globals())
import pandas as pd 

My SQL query:

SELECT movie, rating_ball, director
FROM bf 
WHERE director = 'Стивен Спилберг'

movies = pysqldf(query)
print(movies)

And the output is like:

Empty DataFrame
Columns: [movie, rating_ball, director]
Index: []

But when I delete 'WHERE' clause, it works. I don't know why. I tried to change 'Стивен Спилберг' on "Стивен Спилберг", but it still doesn't work.

The first 5 lines in my DF: enter image description here

0

There are 0 answers