Closed mhebing closed 8 years ago
import pandas as pd import numpy as np x = pd.DataFrame(dict(a = [1, 2, 1, 2], w = [0.5, 0.5, 1, 10])) x.a.value_counts() x.pivot_table(index="a", values="w", aggfunc=np.sum)