Skip to content
Ferenc Bodon edited this page May 27, 2018 · 23 revisions

Creation

command Q Python Q example Python example comment
Q multiplicator of eights ([] ) til pd.DataFrame np.array range ([] a: 8 * til 4) pd.DataFrame({'a': 8 * np.array(range(4))}) so much typing in Python

Overview of the table

command Q Python Q example Python example comment
P basic statistics of numeric columns not supported describe t.describe()
type of columns meta dytpes meta t t.dtypes

Look up

command Q Python Q example Python example comment
subset of table: columns # [] `a`b#t t[['a, 'b']]
first n rows of a table # head 15#t t.head(15)
last n rows of a table # tail -3#t t.tail(3)
concating list of tables into one table raze pd.concat raze lt pd.concat(lt)

New Columns

command mode Q Python Q example Python example
conditional column selection inplace select ? np.where t:select price: ?[side = `buy; bid; ask] from t t["price"]= np.where(t.side == "buy", t.ask, t.bid)
as single column table select price: ?[side = `buy; bid; ask] from t pd.DataFrame(np.where(t.e == "b", t.a, t.b), columns=["price"])
sum of other colums specified by a list as single column table ([] ) sum sum to_frame ([] newCol: sum each l#t) t[l].sum(axis=1).to_frame('newCol')
new column inplace update sum sum t: update newCol: sum t l from t df['newCol'] = df[l].sum(axis=1)
Q new column in a new table concat sum to_frame update newCol: sum t l from t pd.concat([df, df[l].sum(axis=1).to_frame('newCol')], axis=1)

Clone this wiki locally