def test_set(): dictionary = {'col1': [1, 2], 'col2': [3, 4]} mdf = mini_pd.MiniDataFrame(dictionary) mdf['col1'] = [5, 6] col1 = mdf['col1'] assert col1[0] == 5 assert col1[1] == 6
def test_min(dic_array, cols, expected_result): df = mini_pd.MiniDataFrame(dic_array, columns=cols) min_df = df.min assert all([a == b for a, b in zip(df.min, expected_result)])
def test_shape_array(array, cols, expected_result): df = mini_pd.MiniDataFrame(array, columns=cols) assert df.shape == expected_result
def test_shape_dict(dic, expected_result): dictionary = dic df = mini_pd.MiniDataFrame(dictionary) assert df.shape == expected_result
def test_sum(dic_array, cols, expected_result): df = mini_pd.MiniDataFrame(dic_array, columns=cols) sum_df = df.sum assert all([a == b for a, b in zip(df.sum, expected_result)])
def test_get(): dictionary = {'col1': [1, 2], 'col2': [3, 4]} mdf = mini_pd.MiniDataFrame(dictionary) col1 = mdf['col1'] assert col1[0] == 1 assert col1[1] == 2