Drop all DataFrame columns of the given "Feed" that are not
    listed in the GTFS.
    Return the resulting new "Feed".
336961
def drop_invalid_columns(feed: "Feed") -> "Feed":
    
    feed = feed.copy()
    for table, group in cs.GTFS_REF.groupby("table"):
        f = getattr(feed, table)
        if f is None:
            continue
        valid_columns = group["column"].values
        for col in f.columns:
            if col not in valid_columns:
                print(f"{table}: dropping invalid column {col}")
                del f[col]
        setattr(feed, table, f)

    return feed
1269848
def reset_index(self):
        
        new_columns = OrderedDict()

        new_index = default_index(_obtain_length(self._length, self._data))

        new_columns.update((name, Series(data.values, new_index, data.dtype, name))
                           for name, data in self.index._gather_data().items())

        # the data/columns
        new_columns.update((sr.name, Series(sr.values, new_index, sr.dtype, sr.name))
                           for sr in self._iter())

        return DataFrame(new_columns, new_index)
972298
def _clean_data(data):
    '''
    
    '''
    for key in list(data):
        if key.startswith('__pub'):
            del data[key]
    return data
1255507
def clean_df(df, header=None, **read_csv_kwargs):
    
    df = read_csv(df, header=header, **read_csv_kwargs)
    df = df.fillna(' ')
    for col in df.columns:
        df[col] = df[col].apply(unicode2ascii)
    return df
223468
def transform_dataframe(self, dataframe):
        
        dataframe.columns.name = ""

        for i in range(len(self.get_header_fields())):
            dataframe = dataframe.unstack()

        # Remove blank rows / columns
        dataframe = dataframe.dropna(
            axis=0, how='all'
        ).dropna(
            axis=1, how='all'
        )
        return dataframe
183513
def dropna(self):
        
        not_nas = [v.notna() for v in self.values]
        and_filter = reduce(lambda x, y: x & y, not_nas)

        return self[and_filter]
915422
def dropr(self, *rows):
        
        try:
            self.df = rows = list(rows)
            self.df.drop(rows)
        except Exception as e:
            self.err(e, self.dropr, "Can not drop rows")
19721
def drop_column(self, *columns):
        
        columns = list(columns)

        return self._add_command("drop_column", columns=columns)
162707
public void dropXColumns(Set<Object> columnSet) {
        columnSet.retainAll(data.xDataTypes.keySet()); //keep only those columns that are already known to the Meta data of the Dataframe

        if(columnSet.isEmpty()) {
            return;
        }

        //remove all the columns from the Meta data
        data.xDataTypes.keySet().removeAll(columnSet);

        streamExecutor.forEach(StreamMethods.stream(entries(), true), e -> {
            Integer rId = e.getKey();
            Record r = e.getValue();

            AssociativeArray xData = r.getX().copy();
            boolean modified = xData.keySet().removeAll(columnSet);

            if(modified) {
                Record newR = new Record(xData, r.getY(), r.getYPredicted(), r.getYPredictedProbabilities());

                //safe to call in this context. we already updated the meta when we modified the xDataTypes
                _unsafe_set(rId, newR);
            }
        });

    }
303556
def drop_if(df, fun):
    

    def _filter_f(col):
        try:
            return fun(df[col])
        except:
            return False

    cols = list(filter(_filter_f, df.columns))
    return df.drop(cols, axis=1)
929147
def none_missing(df, columns=None):
    
    if columns is None:
        columns = df.columns
    assert not df[columns].isnull().any().any()
    return df
492756
def _datatable_factory(self):
        
        feed_cols = ['feed{0:03d}'.format(i + 1) for i in range(self.n_feeds)]
        feed_cols = ['override_feed000'] + feed_cols + ['failsafe_feed999']

        ind_sqlatyp = indexingtypes[self.index.indimp].sqlatyp
        dat_sqlatyp = datadefs[self.dtype.datadef].sqlatyp

        atbl = Table(self.name, Base.metadata,
                     Column('indx', ind_sqlatyp, primary_key=True),
                     Column('final', dat_sqlatyp),
                     *(Column(fed_col, dat_sqlatyp) for fed_col in feed_cols),
                     extend_existing=True)
        
        self.dt_feed_cols = feed_cols[:]
        self.dt_all_cols = ['indx', 'final'] + feed_cols[:]
        return atbl
25631
def keep(self, keep_names):
        """"""
        
        current_names = self._data.columns
        drop_names = []
        for name in current_names:
            if name not in keep_names:
                drop_names.append(name)
        self.drop(drop_names)
619050
def strip_cols(self):
        
        cols = {}
        skipped = []
        for col in self.df.columns.values:
            try:
                cols[col] = col.strip()
            except Exception:
                skipped.append(str(col))
        self.df = self.df.rename(columns=cols)
        self.ok("White spaces removed in columns names")
        if len(skipped) > 0:
            self.info("Skipped columns", ','.join(
                skipped), "while removing white spaces")
735158
def clear_file_systems(self):
        """"""

        self._source_url = None
        self.dataset.config.library.source.url = None
        self._source_fs = None

        self._build_url = None
        self.dataset.config.library.build.url = None
        self._build_fs = None

        self.dataset.commit()
142768
def sort_dataframe_cols(self):
        
        # get the group for each column
        cols = self.df.columns
        groups = list(map(lambda x: self.data_model.get_group_for_col(self.dtype, x), cols))
        sorted_cols = cols.groupby(groups)
        ordered_cols = []
        # put names first
        try:
            names = sorted_cols.pop('Names')
        except KeyError:
            names = []
        ordered_cols.extend(list(names))
        no_group = []
        # remove ungrouped columns
        if '' in sorted_cols:
            no_group = sorted_cols.pop('')
        # flatten list of columns
        for k in sorted(sorted_cols):
            ordered_cols.extend(sorted(sorted_cols[k]))
        # add back in ungrouped columns
        ordered_cols.extend(no_group)
        # put name first
        try:
            if self.name in ordered_cols:
                ordered_cols.remove(self.name)
                ordered_cols[:0] = [self.name]
        except AttributeError:
            pass
        #
        self.df = self.df[ordered_cols]
        return self.df
895674
def filter_(self, columns, value):
        

        for column in columns:
            if column not in self.data.columns:
                raise ValueError("Column %s not in DataFrame columns: %s" % (column, list(self.data)))

        for column in columns:
            # Filtering on empty data series doesn't make sense at all and also would raise an error
            column_len = len(self.data[column])
            if column_len > 0 and column_len != self.data[column].isnull().sum():
                self.data = self.data[self.data[column] != value]

        return self.data