def test_inplace_dropping_single_row_in_column_distributed_dataframe(self): df = ParallelDataFrame(self.dict2, dist_data=False) self.assertEqual(df.globalShape, (3, 4)) df.drop(2, axis=0, inplace=True) self.assertEqual(set(list(df.globalColumns)), set(['key1', 'key2', 'key3', 'key4'])) self.assertEqual(list(df.globalIndex), [0, 1])
def test_inplace_dropping_multiple_columns_in_column_distributed_dataframe( self): df = ParallelDataFrame(self.dict3, dist_data=False) self.assertEqual(df.globalShape, (3, 8)) df.drop(['key4', 'key8'], axis=1, inplace=True) self.assertEqual(set(list(df.globalColumns)), set(['key1', 'key2', 'key3', 'key5', 'key6', 'key7'])) self.assertEqual(list(df.globalIndex), [0, 1, 2])
def test_non_inplace_dropping_multiple_columns_and_row_in_same_call_replicated_dataframe( self): df = ParallelDataFrame(self.dict3, dist='replicated') new_df = df.drop(columns=['key4', 'key7'], index=1, inplace=False) self.assertEqual( set(list(new_df.globalColumns)), set(['key1', 'key2', 'key3', 'key5', 'key6', 'key8'])) self.assertEqual(list(new_df.globalIndex), [0, 2])
def test_non_inplace_dropping_single_column_in_column_distributed_dataframe( self): df = ParallelDataFrame(self.dict2, dist_data=False) self.assertEqual(df.globalShape, (3, 4)) new_df = df.drop('key4', axis=1, inplace=False) self.assertEqual(set(list(new_df.globalColumns)), set(['key1', 'key2', 'key3'])) self.assertEqual(list(new_df.globalIndex), [0, 1, 2])
def test_inplace_dropping_single_row_replicated_dataframe(self): df = ParallelDataFrame(self.dict2, dist='replicated') df.drop(2, axis=0, inplace=True) self.assertEqual(set(list(df.globalColumns)), set(['key1', 'key2', 'key3', 'key4'])) self.assertEqual(list(df.globalIndex), [0, 1])