Most common Pandas operations and their SQL translations in one frame.
Thanks Avi, but one point: COUNT(*) only returns the number of rows in a table, so it's not the full equivalent of df.shape.
For the number of columns one can use:
SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_catalog = 'database_name' -- the database
AND table_name = 'table_name'
Thanks for pointing that out, Nic :)
I totally missed including that. Appreciate it.
Thanks Avi, but one point: COUNT(*) only returns the number of rows in a table, so it's not the full equivalent of df.shape.
For the number of columns one can use:
SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_catalog = 'database_name' -- the database
AND table_name = 'table_name'
Thanks for pointing that out, Nic :)
I totally missed including that. Appreciate it.