def test_batch_to_xlsx_a(self) -> None: f1 = Frame.from_dict( dict(a=(1,2), b=(3,4)), index=('x', 'y'), name='f1') f2 = Frame.from_dict( dict(a=(1,2,3), b=(4,5,6)), index=('x', 'y', 'z'), name='f2') f3 = Frame.from_dict( dict(a=(10,20), b=(50,60)), index=('p', 'q'), name='f3') config = StoreConfig( index_depth=1, columns_depth=1, include_columns=True, include_index=True ) b1 = Batch.from_frames((f1, f2, f3)) with temp_file('.xlsx') as fp: b1.to_xlsx(fp) b2 = Batch.from_xlsx(fp, config=config) frames = dict(b2.items()) for frame in (f1, f2, f3): # parquet brings in characters as objects, thus forcing different dtypes self.assertEqualFrames(frame, frames[frame.name], compare_dtype=False)
def test_batch_to_zip_parquet_a(self) -> None: f1 = Frame.from_dict(dict(a=(1, 2), b=(3, 4)), index=('x', 'y'), name='f1') f2 = Frame.from_dict(dict(a=(1, 2, 3), b=(4, 5, 6)), index=('x', 'y', 'z'), name='f2') config = StoreConfig(index_depth=1, columns_depth=1, include_columns=True, include_index=True) b1 = Batch.from_frames((f1, f2), config=config) with temp_file('.xlsx') as fp: b1.to_xlsx(fp) b2 = (Batch.from_xlsx(fp, config=config) * 20).sum() self.assertEqual(b2.to_frame().to_pairs(0), (('a', (('f1', 60), ('f2', 120))), ('b', (('f1', 140), ('f2', 300)))))