1

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

1
  • I'm not able to read that language, so not sure if there's a difference between UPPER and lower case? Try casting perhaps? Commented Oct 17, 2023 at 21:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.