def test_dataframe_append_to_empty(): pdf = pd.DataFrame() pdf['a'] = [] pdf['b'] = [1, 2, 3] gdf = DataFrame() gdf['a'] = [] gdf['b'] = [1, 2, 3] pd.testing.assert_frame_equal(gdf.to_pandas(), pdf)
def test_dataframe_masked_slicing(nelem, slice_start, slice_end): gdf = DataFrame() gdf['a'] = list(range(nelem)) gdf['b'] = list(range(nelem, 2 * nelem)) gdf['a'] = gdf['a'].set_mask(utils.random_bitmask(nelem)) gdf['b'] = gdf['b'].set_mask(utils.random_bitmask(nelem)) def do_slice(x): return x[slice_start:slice_end] expect = do_slice(gdf.to_pandas()) got = do_slice(gdf).to_pandas() pd.testing.assert_frame_equal(expect, got)