How to Convert SQL into Python Pandas? Part 5
Previously on How to Convert SQL into Python Pandas? Part 4, we talked about how to convert SQL statements into Pandas syntax. In this article, we will continue to discover more scenarios and operations. (Data import into Python)
Where (=)
-- SQL
SELECT *
FROM main.invoices
WHERE BillingCountry = 'Germany'
# Python Pandas 1
filt = df_invoices['BillingCountry'] == "Germany"
df_invoices[filt]
# Python Pandas 2
df_invoices.query("BillingCountry == 'Germany'")
Keep reading with a 7-day free trial
Subscribe to Informula to keep reading this post and get 7 days of free access to the full post archives.