Ejemplo n.º 1
0
def _as_df(ds_name: str, **kwargs) -> pandas.DataFrame:
    """Loads the dataset as `pandas.DataFrame`."""
    with testing.mock_data(num_examples=3):
        ds, ds_info = load.load(ds_name,
                                split='train',
                                with_info=True,
                                **kwargs)
    df = as_dataframe.as_dataframe(ds, ds_info)
    return df
Ejemplo n.º 2
0
def test_as_dataframe():
    """Tests that as_dataframe works without the `tfds.core.DatasetInfo`."""
    ds = tf.data.Dataset.from_tensor_slices({
        'some_key': [1, 2, 3],
        'nested': {
            'sub1': [1.0, 2.0, 3.0],
        },
    })
    df = as_dataframe.as_dataframe(ds)
    assert isinstance(df, pandas.DataFrame)
    assert df._repr_html_().startswith('<style')