Insert ``pandas.DataFrame``.

    :param col: :class:`pymongo.collection.Collection` instance.
    :param df: :class:`pandas.DataFrame` instance.
    :param int_col: list of integer-type column.
    :param binary_col: list of binary-type column.
346395
def insert_data_frame(col, df, int_col=None, binary_col=None, minimal_size=5):
    
    data = transform.to_dict_list_generic_type(df,
                                               int_col=int_col,
                                               binary_col=binary_col)
    smart_insert(col, data, minimal_size)
239277
def dflin2dfbinarymap(dflin,col1,col2,params_df2submap={'aggfunc':'sum','binary':True,'binaryby':'nan'},test=False):
    
    # get the submap ready
    df_map=df2submap(df=dflin,
              col=col1,idx=col2,**params_df2submap)
    if test:           
        logging.debug(df_map.unstack().unique())
    # make columns and index symmetric
    df_map_symm=dfmap2symmcolidx(df_map)
    df_map_symm=df_map_symm.fillna(False)
    if test:           
        logging.debug(df_map_symm.unstack().unique())
    df_map_symm=(df_map_symm+df_map_symm.T)/2
    if test:           
        logging.debug(df_map_symm.unstack().unique())
    df_map_symm=df_map_symm!=0
    if test:           
        logging.debug(df_map_symm.unstack().unique())
    return df_map_symm
1340263
def add_column(self, name, type_name, options=None):
        
        column = Column(name, type_name, options)

        self._add_column(column)

        return column
579898
def stringify_col(df, col_name):
    
    df = df.copy()
    df[col_name] = df[col_name].fillna("")
    df[col_name] = df[col_name].astype(str)
    return df
124508
def transform(self, col):
        

        out = pd.DataFrame()

        # Make sure all nans are handled the same by replacing with None
        column = col[self.col_name].replace({np.nan: None})
        out[self.col_name] = column.apply(self.get_val)

        return out
635186
def add_data_to_df(self, data: np.array):
        """"""

        col_names = ['high_p', 'low_p', 'open_p', 'close_p', 'volume', 'oi']

        data = np.array(data).reshape(-1, len(col_names) + 1)
        df = pd.DataFrame(data=data[:, 1:], index=data[:, 0],
                          columns=col_names)

        df.index = pd.to_datetime(df.index)

        # Sort the dataframe based on ascending dates.
        df.sort_index(ascending=True, inplace=True)

        # Convert dataframe columns to float and ints.
        df[['high_p', 'low_p', 'open_p', 'close_p']] = df[
            ['high_p', 'low_p', 'open_p', 'close_p']].astype(float)
        df[['volume', 'oi']] = df[['volume', 'oi']].astype(int)

        if self._ndf.empty:
            self._ndf = df
        else:
            self._ndf = self._ndf.append(df)
639768
def insert_df(self, table_name, df):
        """"""
        df.to_sql(table_name, con=self.own_connection)
1341076
def transform(self, column):
        
        self.check_data_type()

        return pd.DataFrame({self.col_name: np.exp(column[self.col_name])})
1239733
def conv(col, fromBase, toBase):
    
    sc = SparkContext._active_spark_context
    return Column(sc._jvm.functions.conv(_to_java_column(col), fromBase, toBase))
1227518
def make_exploded_column(df, colname_new, colname_old):
    
    s = df[colname_old].apply(pd.Series).stack()
    s.name = colname_new
    return s
816503
def docify(self, df):
        
        dtypes = {}
        masks = {}
        lengths = {}
        columns = []
        data = Binary(b'')
        start = 0

        arrays = []
        for c in df:
            try:
                columns.append(str(c))
                arr, mask = self._convert_types(df[c].values)
                dtypes[str(c)] = arr.dtype.str
                if mask is not None:
                    masks[str(c)] = Binary(compress(mask.tostring()))
                arrays.append(arr.tostring())
            except Exception as e:
                typ = infer_dtype(df[c], skipna=False)
                msg = "Column '{}' type is {}".format(str(c), typ)
                logging.info(msg)
                raise e

        arrays = compress_array(arrays)
        for index, c in enumerate(df):
            d = Binary(arrays[index])
            lengths[str(c)] = (start, start + len(d) - 1)
            start += len(d)
            data += d

        doc = SON({DATA: data, METADATA: {}})
        doc[METADATA] = {COLUMNS: columns,
                         MASK: masks,
                         LENGTHS: lengths,
                         DTYPE: dtypes
                         }

        return doc
1090400
def col(self, col_name_or_num):
        
        if isinstance(col_name_or_num, basestring):
            return self[col_name_or_num]
        elif isinstance(col_name_or_num, (int, long)):
            if col_name_or_num > len(self.fields):
                raise IndexError("Invalid column index `%s` for DataTable" %
                                 col_name_or_num)
            return self.__data[self.fields[col_name_or_num]]
1028491
def insert(self, index, filename):
        """"""
        base = self._base
        dct = {'__module__': base.__module__, 'filename': filename, '_stack': self}
        cls = type(base.__name__, (base,), dct)

        self._map[cls.filename] = cls
        self._classes.insert(index, cls)
1234829
def gmean_(self, col: str, index_col: bool=True) -> "Ds":
        
        try:
            df = self.df.copy()
            df = df.groupby([col]).mean()
            if index_col is True:
                df[col] = df.index.values
            return self._duplicate_(df)
        except Exception as e:
            self.err(e, self.gmean_, "Can not meansum column")
993261
def add_col(self, label):
        
        self.table.dataframe[label] = ''
        self.AppendCols(1, updateLabels=False)
        last_col = self.table.GetNumberCols() - 1
        self.SetColLabelValue(last_col, label)
        self.col_labels.append(label)
        self.size_grid()
        return last_col
1370952
def apply(self, df):
        
        if hasattr(self.definition, '__call__'):
            r = self.definition(df)
        elif self.definition in df.columns:
            r = df[self.definition]
        elif not isinstance(self.definition, string_types):
            r = pd.Series(self.definition, index=df.index)
        else:
            raise ValueError("Invalid column definition: %s" % str(self.definition))
        return r.astype(self.astype) if self.astype else r
1038171
def _col_type_set(self, col, df):
        
        type_set = set()
        if df[col].dtype == np.dtype(object):
            unindexed_col = list(df[col])
            for i in range(0, len(df[col])):
                if unindexed_col[i] == np.nan:
                    continue
                else:
                    type_set.add(type(unindexed_col[i]))
            return type_set
        else:
            type_set.add(df[col].dtype)
            return type_set