Example #1
0
def test_table_from_pandas():
    """Test inputting tables from pandas dataframe."""
    pd = pytest.importorskip("pandas",
                             reason="Pandas required for some tables tests")
    df = pd.DataFrame.from_dict(_TABLE_DATA["dict"])
    table = Table(value=df)
    table.to_dataframe() == df
Example #2
0
def test_joins_with_pandas():
    """Test that pandas can help with ugly data."""
    pd = pytest.importorskip("pandas", reason="Pandas required for some tables tests")

    t = Table(value=ugly_dict)
    assert t.shape == (5, 3)
    pd.testing.assert_frame_equal(t.to_dataframe(), pd.DataFrame(ugly_dict))

    t2 = Table(value=ugly_records)
    assert t2.shape == (3, 3)
    pd.testing.assert_frame_equal(t2.to_dataframe(), pd.DataFrame(ugly_records))