Esempio n. 1
0
def delete_columns_array(frame):
    # datatable supports a shape of n x 0 for non-zero n's, while
    # python doesn't, so we never remove all the columns from a Frame.
    if frame.ncols < 2:
        return
    s = random_array(frame.ncols - 1, positive=True)
    frame.delete_columns(s)
Esempio n. 2
0
 def __init__(self, context):
     super().__init__(context)
     # datatable supports a shape of n x 0 for non-zero n's, while
     # python doesn't, so we never remove all the columns from a Frame.
     ncols = self.frame.ncols
     nkeys = self.frame.nkeys
     if ncols <= 1:
         self.skipped = True
     else:
         self.array = random_array(ncols - 1, positive=True)
         set_keys = set(range(nkeys))
         set_delcols = set(self.array)
         self.n_keys_to_remove = len(set_keys.intersection(set_delcols))
         if (self.n_keys_to_remove > 0 and self.n_keys_to_remove < nkeys
                 and self.frame.nrows > 0):
             self.raises = ValueError
             self.error_message = "Cannot delete a column that is a part " \
                                  "of a multi-column key"
Esempio n. 3
0
 def __init__(self, context):
     super().__init__(context)
     self.skipped = (self.frame.nrows == 0)
     if not self.skipped:
         self.array = random_array(self.frame.nrows, positive=True)
         self.array = sorted(set(self.array))
Esempio n. 4
0
def delete_rows_array(frame):
    if frame.nrows == 0:
        return
    s = random_array(frame.nrows, positive=True)
    s = sorted(set(s))
    frame.delete_rows(s)
Esempio n. 5
0
def select_rows_array(frame):
    if frame.nrows == 0:
        return
    s = random_array(frame.nrows)
    frame.slice_rows(s)
Esempio n. 6
0
 def __init__(self, context):
     super().__init__(context)
     if self.frame.nrows == 0:
         self.skipped = True
     else:
         self.array = random_array(self.frame.nrows)