Filter data from pd.read_sql_query

Issue

This Content is from Stack Overflow. Question asked by beginofwork

I’m using ‘pd.read_sql_query’ to extract the data from microsoft sql in python.
However, when I’m trying to filter specified row from the query, it show blank/ no result.

sql = pd.read_sql_query('''

                SELECT * FROM table
                       
                 ''', conn) 


df = pd.DataFrame(sql)


given = '02/03/2022'

given = datetime.strptime(given, '%d/%m/%Y')


dff = df[df['Date'] == given]

print(dff)

What is the issue?



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?