def testSimple(self): df = asDataFrame(self.data) self.assertEqual(list(df.columns), ["colC", "colB", "colA"]) self.assertEqual(list(df.index), ["rowC", "rowB", "rowA"])
def testEmptyRow(self): for row in self.data.keys(): dd = deepcopy(self.data) dd[row] = odict() df = asDataFrame(dd) self.assertEqual(list(df.columns), ["colC", "colB", "colA"]) self.assertEqual(list(df.index), ["rowC", "rowB", "rowA"])
def testMissingValues(self): for row, col in itertools.product( ("rowA", "rowB", "rowC"), ("colA", "colB", "colC")): dd = deepcopy(self.data) del dd[row][col] df = asDataFrame(dd) if row == "rowC" and col == "colB": # first row misses column B, so column A is second self.assertEqual(list(df.columns), ["colC", "colA", "colB"]) elif row == "rowC" and col == "colC": # first row misses column C, so column B is second self.assertEqual(list(df.columns), ["colB", "colA", "colC"]) else: self.assertEqual(list(df.columns), ["colC", "colB", "colA"]) self.assertEqual(list(df.index), ["rowC", "rowB", "rowA"])