Aggregation functions come up a lot, and are related to pivots. A pivot has pseudo-code that looks like this:
def pivot(self, pivot_column, value_column): new_columns = list(set([r[pivot_column] for r in self.rows])) new_rows = [[0 for i in r[1:] for r in self.rows] for i in len(new_rows): row = self.rows[i] new_rows[i][new_columns[row[pivot_column]]] = row[value_column] return Table(new_rows, newCoumns)
A count takes in a bunch of key_columns, and counts the number of unique entries for each value of the key columns.
Aggregation functions come up a lot, and are related to pivots. A pivot has pseudo-code that looks like this:
def pivot(self, pivot_column, value_column): new_columns = list(set([r[pivot_column] for r in self.rows])) new_rows = [[0 for i in r[1:] for r in self.rows] for i in len(new_rows): row = self.rows[i] new_rows[i][new_columns[row[pivot_column]]] = row[value_column] return Table(new_rows, newCoumns)
A count takes in a bunch of key_columns, and counts the number of unique entries for each value of the key columns.
Both return new tables.