예제 #1
0
파일: test_ddf.py 프로젝트: SeamlessML/ddf
def test_concatenate_df_with_non_overlapping_cols():
    d1 = DDF({'col1': np.arange(4), 'col2': np.arange(4)})
    d2 = DDF({'col1': np.arange(2)})
    d3 = d1.append(d2, axis=0)
    expected_col1 = np.array([0, 1, 2, 3, 0, 1])
    expected_col2 = np.array([0, 1, 2, 3, np.nan, np.nan])
    np.testing.assert_array_equal(d3['col1'], expected_col1)
    np.testing.assert_array_equal(d3['col2'], expected_col2)
예제 #2
0
def test_append_csv(tmpdir):
    path = str(tmpdir) + 'log.csv'
    data = DDF({'a': 1, 'b': 10})
    append_csv(data, path)
    loaded = DDF.from_csv(path)
    assert loaded.equals(data)

    new_data = DDF({'a': 100, 'b': 101})
    append_csv(new_data, path)
    loaded_appended = DDF.from_csv(path)
    appended = data.append(new_data)
    assert appended.equals(loaded_appended)
예제 #3
0
파일: test_ddf.py 프로젝트: SeamlessML/ddf
def test_appending_dfs_with_one_scalar_row():
    df = DDF({'a': 0.10229005573016618})
    other_df = DDF({'b': 0.10229005573016618})
    df.append(other_df, axis=0)
예제 #4
0
파일: test_ddf.py 프로젝트: SeamlessML/ddf
def test_appending_new_df_with_new_cols():
    d1 = DDF({'col1': np.arange(4), 'col2': np.arange(4)})
    d2 = DDF({'col1': np.arange(2), 'col3': np.arange(2)})
    d3 = d1.append(d2, axis=0)
    assert len(d3) == 6
예제 #5
0
파일: test_ddf.py 프로젝트: SeamlessML/ddf
def test_appending_with_timedeltas():
    df = DDF({'delta': np.array([100, 'NaT'], dtype='timedelta64[ns]')})
    other_df = DDF()
    df.append(other_df, axis=0)