Understand the difference between sql statements

UNION ALL and UNION LIKE and ILIKE NOT and ! and <> DATE_PART() and DATE_TRUNC() UNION ALL and UNION UNIONThe UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type. With UNION, only distinct values are selected. UNION ALLThe UNION ALL command is equal to the UNION command, except that UNION ALL selects all values. The difference… Continue reading Understand the difference between sql statements

Selecting Subsets of Data in Pandas

from What Code single column  df[‘food’] multiple columns df[[‘color’, ‘food’, ‘score’]] single row df.loc[‘Niko’] multiple rows df.loc[[‘Niko’, ‘Penelope’]] slice notation to select a range of rows df.loc[‘Niko’:’Dean’]   df.loc[:’Aaron’] stepping by 2 df.loc[‘Niko’:’Christina’:2] rows and columns df.loc[row_selection, column_selection]   df.loc[‘Jane’:’Penelope’, [‘state’, ‘color’]] single row df.iloc[3] multiple rows df.iloc[[5, 2, 4]]   df.iloc[3:5]   df.iloc[[2,3], [0,… Continue reading Selecting Subsets of Data in Pandas

Pandas V.S SQL

If you knew SQL before and want to migrate to Python, you can use this article. TiTle SQL Pandas Desc Simple SELECT total_bill, tip, smoker, time FROM tips LIMIT ۵; tips[[‘total_bill’, ‘tip’, ‘smoker’, ‘time’]].head(۵)   Where SELECT * FROM tips WHERE time = ‘Dinner’ LIMIT ۵; tips[tips[‘time’] == ‘Dinner’].head(۵)   Multiple conditions SELECT * FROM tips WHERE… Continue reading Pandas V.S SQL