Returns all the records as a list of :class:`Row`.

        >>> df.collect()
        [Row(age=2, name=u'Alice'), Row(age=5, name=u'Bob')]
176238
def collect(self):
        
        with SCCallSiteSync(self._sc) as css:
            sock_info = self._jdf.collectToPython()
        return list(_load_from_socket(sock_info, BatchedSerializer(PickleSerializer())))
718430
def list_marts(self):
        

        def _row_gen(attributes):
            for attr in attributes.values():
                yield (attr.name, attr.display_name)

        return pd.DataFrame.from_records(
            _row_gen(self.marts), columns=['name', 'display_name'])
1175147
def records(self):
		''''''
		if self._records == None:
			self._records = self._get_records()
		return self._records
961662
def dataframes(self):
        
        frames = []
        for team in self.__iter__():
            frames.append(team.dataframe)
        return pd.concat(frames)
318862
def _get_all(self):
        
        return [self._to_dict(row) for row in models.User.objects.all()]
693569
def fetch_data_by_list(self, entities: List[str], limit=50000):
        

        if not len(set([e.split(".")[0] for e in entities])) == 1:
            print("Error: entities must be from same domain.")
            return

        if len(entities) == 1:
            print("Must pass more than 1 entity.")
            return
        query = text(
            """
            SELECT entity_id, state, last_changed
            FROM states
            WHERE entity_id in ({})
            AND NOT state='unknown'
            ORDER BY last_changed DESC
            LIMIT :limit
            """.format(
                ",".join("'{}'".format(ent) for ent in entities)
            )
        )

        response = self.perform_query(query, limit=limit)
        df = pd.DataFrame(response.fetchall())
        df.columns = ["entity", "state", "last_changed"]
        df = df.set_index("last_changed")  # Set the index on datetime
        df.index = pd.to_datetime(df.index, errors="ignore", utc=True)
        try:
            df["state"] = (
                df["state"].mask(df["state"].eq("None")).dropna().astype(float)
            )
            df = df.pivot_table(index="last_changed", columns="entity", values="state")
            df = df.fillna(method="ffill")
            df = df.dropna()  # Drop any remaining nan.
            return df
        except:
            print("Error: entities were not all numericals, unformatted df.")
            return df
101913
def get_rows(self, sort=False):
        
        ret = []
        for _, rows in sorted(self._rows.items()) if sort else self._rows.items():
            self._rows_int2date(rows)
            ret.extend(rows)

        return ret
1348126
def fetchall(self):
        
        if self._state == self._STATE_NONE:
            raise Exception("No query yet")

        if not self._data:
            return []
        else:
            result, self._data = self._data, []
            self._rownumber += len(result)
            return result
742937
def items(self):
        
        if not self.cursor.rowcount:
            return []

        self.cursor.scroll(0, 'absolute')
        return self.cursor.fetchall()
628318
def as_dict(self):
        
        if not self.cursor.rowcount:
            return {}

        self._rewind()
        if self.cursor.rowcount == 1:
            return dict(self.cursor.fetchone())
        else:
            raise ValueError('More than one row')
610137
def to_dataframe(self):
    

    data = []
    for target_index, target_row in enumerate(self._cm):
      for predicted_index, count in enumerate(target_row):
        data.append((self._labels[target_index], self._labels[predicted_index], count))

    return pd.DataFrame(data, columns=['target', 'predicted', 'count'])
562831
def getall(self, table):
        
        try:
            self._check_db()
        except Exception as e:
            self.err(e, "Can not connect to database")
            return
        if table not in self.db.tables:
            self.warning("The table " + table + " does not exists")
            return
        try:
            res = self.db[table].all()
            df = pd.DataFrame(list(res))
            return df
        except Exception as e:
            self.err(e, "Error retrieving data in table")
21199
def fetchall(self):
        
        rows = []
        while True:
            row = yield self.fetchone()
            if row is None:
                break
            rows.append(row)
        raise gen.Return(rows)
167370
def as_dictlist(self):
        
        data = []
        for row_i, row in enumerate(self.row_index):
            for col_i, col in enumerate(self.col_index):
                value = self.values_by_row[row_i][col_i]
                data.append({
                    "row": row,
                    "col": col,
                    "value": value,
                    })
        return data
467515
def _get_all(self):
        ''' 
        '''
        rowid = 0
        while True:
            SQL_SELECT_MANY = 'SELECT rowid, * FROM %s WHERE rowid > ? LIMIT ?;' % self._table
            self._cursor.execute(SQL_SELECT_MANY, (rowid, ITEMS_PER_REQUEST))
            items = self._cursor.fetchall()
            if len(items) == 0:
                break
            for item in items:
                rowid = item['_id']
                yield self._make_item(item)
256171
def recarray(self):
        """"""
        return numpy.rec.fromrecords(self.records, names=self.names)
1173622
def extract_rows(data, *rows):
    
    try:
        # for python 2.2
        # return [data[r] for r in rows]
        out = []
        for r in rows:
            out.append(data[r])
        return out
    except IndexError:
        raise IndexError("data=%s rows=%s" % (data, rows))
    return out