Gagi
unread,Nov 16, 2012, 7:07:53 PM11/16/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pyd...@googlegroups.com
Here is the code not clipped:
import pandas as pd
import numpy as np
# Generate Long File & Test Pivot
NUM_ROWS = 1000000
df = pd.DataFrame({'A' : np.random.randint(100, size=NUM_ROWS),
'B' : np.random.randint(300, size=NUM_ROWS),
'C' : np.random.randint(-7, 7, size=NUM_ROWS),
'D' : np.random.randint(-19,19, size=NUM_ROWS),
'E' : np.random.randint(3000, size=NUM_ROWS),
'F' : np.random.randn(NUM_ROWS)})
df_pivoted = df.pivot_table(rows=['A', 'B', 'C'], cols='E', values='F')
df_pivoted