pivot table pd examples
Example 1: pivot table pandas
df.pivot_table(['int_age'],index = [df.iloc[:,meet_friends], df.iloc[:,friendsgiving]])
Example 2: pivot table pandas
tips.pivot_table(index=['day', 'smoker'])
Example 3: pivot table
SELECT * -- Total invoices per gender
FROM (
SELECT invoice, gender
FROM sales
) d
PIVOT (
sum(invoice)
FOR gender IN ('F' AS "Women", 'M' AS "Men")
);
-- Table Sales:
CREATE TABLE sales (
gender VARCHAR2(1 BYTE), -- 'F' or 'M'
invoice NUMBER
);
Example 4: pivot table pandas
df.pivot_table(index = [df.iloc[:,meet_friends], df.iloc[:,friendsgiving]])