Conditional Logic
General Info
Useful Snippets

10.0.0 Query a DataFrame with SQL

Example:

import pandasql
import pandas as pd

# Create a SQL String
sql = '''
        SELECT DF.*
                       Case WHEN Column_Name = 'value' Then 'Yes' ELse 'No' End AS New_Column_Name
        FROM DF
        Where column_Name = 'value'
         '''
# use pandasql to query your dataframe
DF_Filtered = pandasql.sqldf(sql, locals())