Returns a dataframe with html code when you enabled eager evaluation
        by 'spark.sql.repl.eagerEval.enabled', this only called by REPL you are
        using support eager evaluation with HTML.
970239
def _repr_html_(self):
        
        import cgi
        if not self._support_repr_html:
            self._support_repr_html = True
        if self.sql_ctx._conf.isReplEagerEvalEnabled():
            max_num_rows = max(self.sql_ctx._conf.replEagerEvalMaxNumRows(), 0)
            sock_info = self._jdf.getRowsToPython(
                max_num_rows, self.sql_ctx._conf.replEagerEvalTruncate())
            rows = list(_load_from_socket(sock_info, BatchedSerializer(PickleSerializer())))
            head = rows[0]
            row_data = rows[1:]
            has_more_data = len(row_data) > max_num_rows
            row_data = row_data[:max_num_rows]

            html = "<table border='1'>\n"
            # generate table head
            html += "<tr><th>%s</th></tr>\n" % "</th><th>".join(map(lambda x: cgi.escape(x), head))
            # generate table rows
            for row in row_data:
                html += "<tr><td>%s</td></tr>\n" % "</td><td>".join(
                    map(lambda x: cgi.escape(x), row))
            html += "</table>\n"
            if has_more_data:
                html += "only showing top %d %s\n" % (
                    max_num_rows, "row" if max_num_rows == 1 else "rows")
            return html
        else:
            return None
632063
def broadcast(df):
    """"""

    sc = SparkContext._active_spark_context
    return DataFrame(sc._jvm.functions.broadcast(df._jdf), df.sql_ctx)
230763
def display_charts(df, chart_type="default", render_to=None, **kwargs):
    
    if chart_type not in ("default", "stock"):
        raise ValueError("Wrong chart_type: accept 'default' or 'stock'.")
    chart_id = render_to if render_to is not None else _generate_div_id_chart()
    json_data = serialize(df, render_to=chart_id, chart_type=chart_type,
                          **kwargs)
    content = """<div id="{chart_id}"</div>
    <script type="text/javascript">{data}</script>"""
    return display(HTML(content.format(chart_id=chart_id,
                                       data=json_data)))
1268013
def rdd(self):
        
        if self._lazy_rdd is None:
            jrdd = self._jdf.javaToPython()
            self._lazy_rdd = RDD(jrdd, self.sql_ctx._sc, BatchedSerializer(PickleSerializer()))
        return self._lazy_rdd
1039099
public <T extends Evaluation> T evaluate(RDD<DataSet> data) {
        return evaluate(data.toJavaRDD());
    }
442834
def evaluate(self, verbose=True, passes=None):
        
        i = 0
        exprs = []
        for column_name in self.column_names:
            if len(self.column_names) > 1:
                index = "1.$%d" % i
            else:
                index = "1"
            expr = self.get_column(
                column_name,
                self.column_types[i],
                index,
                verbose=verbose
            )
            i += 1
            exprs.append(expr)

        i = 0
        for column_name in self.grouping_column_name:
            if len(self.grouping_column_name) > 1:
                index = "0.$%d" % i
            else:
                index = "0"
            expr = self.get_column(
                column_name,
                self.grouping_column_types[i],
                index,
                verbose=verbose
            )
            exprs.append(expr)
            i += 1

        result = utils.group(exprs).evaluate(verbose=verbose, passes=passes)
        df = pd.DataFrame(columns=[])
        all_columns = self.column_names + self.grouping_column_name
        for i, column_name in enumerate(all_columns):
            df[column_name] = result[i]
        return dataframeweld.DataFrameWeld(df)
149089
def _get_dataframe(self):
        
        if self.source_conn is None:  # Use local file
            return ge.read_csv(self.dataset_name, **self.dataset_params)

        if isinstance(self.source_conn, S3Hook):
            hook = ExpectationS3CsvHook(aws_conn_id=self.source_conn_id)

            return hook.get_ge_df(self.dataset_name, self.source_bucket_name, **self.dataset_params)

        if isinstance(self.source_conn, DbApiHook):
            hook = ExpectationMySQLHook(mysql_conn_id=self.source_conn_id)

            return hook.get_ge_df(self.dataset_name, **self.dataset_params)
332323
def get_dataframe_row(self, dataset_cases, predicted_data, pdb_data, record_id, additional_prediction_data_columns):
        ''''''
        record = dataset_cases[record_id]
        for m in record['PDBMutations']:
            assert('DSSPSimpleSSType' not in m)
            m['DSSPSimpleSSType'] = dssp_elision.get(m['ComplexDSSP']) or dssp_elision.get(m['MonomericDSSP'])
            m['DSSPType'] = m.get('ComplexDSSP') or m.get('MonomericDSSP')
            m['DSSPExposure'] = m.get('ComplexExposure') or m.get('MonomericExposure')

        dataframe_record = super(DBBenchmarkRun, self).get_dataframe_row(dataset_cases, predicted_data, pdb_data, record_id, additional_prediction_data_columns)
        # add columns
        return dataframe_record
1010571
def make_dataframe(obj, columns=None, exclude=None, limit=1e8):
    """"""
    try:
        obj = obj.objects.all()[:limit]
    except:
        pass
    if isinstance(obj, (pd.Series, list, tuple)):
        return make_dataframe(pd.DataFrame(obj), columns, exclude, limit)
    # if the obj is a named tuple, DataFrame, dict of columns, django QuerySet, sql alchemy query result
    # retrieve the "include"d field/column names from its keys/fields/attributes
    if columns is None:
        columns = get_column_labels(obj)
    if exclude is not None and columns is not None and columns and exclude:
        columns = [i for i in columns if i not in exclude]
    try:
        return pd.DataFrame(list(obj.values(*columns)[:limit]))
    except:
        pass
    try:
        return pd.DataFrame(obj)[fuzzy_get(obj, columns)]
    except:
        pass
    return pd.DataFrame(obj)
344887
def get_dataframe():
        
        names = []
        [names.extend(line.split()) for line in CONTROL_VARIABLE_LINES]

        defaults = []
        [defaults.extend(line.split()) for line in CONTROL_DEFAULT_LINES]

        types, required,cast_defaults,formats = [],[],[],[]
        for name,default in zip(names,defaults):
            if '[' in name or ']' in name:
                required.append(False)
            else:
                required.append(True)
            v,t,f = ControlData._parse_value(default)
            types.append(t)
            formats.append(f)
            cast_defaults.append(v)
        return pandas.DataFrame({"name":names,"type":types,
                                     "value":cast_defaults,"required":required,
                                    "format":formats})
1255693
def dataframe(self):
        """"""

        if self._dataframe is None:
            try:
                import pandas as pd
            except ImportError:
                raise RuntimeError('To enable dataframe support, '
                                   'run \'pip install datadotworld[pandas]\'')

            self._dataframe = pd.DataFrame.from_records(self._iter_rows(),
                                                        coerce_float=True)

        return self._dataframe
421486
def to_instants_dataframe(self, sql_ctx):
        
        ssql_ctx = sql_ctx._ssql_ctx
        jdf = self._jtsrdd.toInstantsDataFrame(ssql_ctx, -1)
        return DataFrame(jdf, sql_ctx)
1334690
def dataframe(self,asql, logger = None):
        """"""
        import pandas as pd
        from ambry.mprlib.exceptions import BadSQLError

        try:
            def yielder(cursor):

                for i, row in enumerate(cursor):
                    if i == 0:
                        yield [ e[0] for e in cursor.getdescription()]

                    yield row

            cursor = self.query(asql, logger)

            yld = yielder(cursor)

            header = next(yld)

            return pd.DataFrame(yld, columns=header)
        except BadSQLError as e:
            import traceback
            self._logger.error("SQL Error: {}".format( e))
            self._logger.debug(traceback.format_exc())
456519
def _py2java(sc, obj):
    
    if isinstance(obj, RDD):
        obj = _to_java_object_rdd(obj)
    elif isinstance(obj, DataFrame):
        obj = obj._jdf
    elif isinstance(obj, SparkContext):
        obj = obj._jsc
    elif isinstance(obj, list):
        obj = [_py2java(sc, x) for x in obj]
    elif isinstance(obj, JavaObject):
        pass
    elif isinstance(obj, (int, long, float, bool, bytes, unicode)):
        pass
    else:
        data = bytearray(PickleSerializer().dumps(obj))
        obj = sc._jvm.org.apache.spark.mllib.api.python.SerDe.loads(data)
    return obj
1166765
def read(self, dataframe_name: str) -> pandas.DataFrame:
        
        code = serialise_dataframe_code(dataframe_name, self.kind)
        output = self._execute(code)
        output.raise_for_status()
        if output.text is None:
            raise RuntimeError("statement had no text output")
        return deserialise_dataframe(output.text)
497460
def dataframe(self):
        """"""
        data = self.data
        channel_names = self.get_channel_names()
        return pd.DataFrame(data, columns=channel_names)
790331
function buildDataTable() {
      var self = this;

      var dataTable = new google.visualization.DataTable();

      _.each(self.columns, function (value) {
        dataTable.addColumn(value);
      });

      if (!_.isEmpty(self.rows)) {
        dataTable.addRows(self.rows);
      }

      return dataTable;
    }