def table_to_dataframe()

in jetstream/bigquery_client.py [0:0]


    def table_to_dataframe(self, table: str, nan_columns: list[str] | None = None) -> pd.DataFrame:
        """Return all rows of the specified table as a dataframe."""
        if nan_columns is None:
            nan_columns = []

        self._storage_client = self._storage_client or BigQueryReadClient()

        table_ref = self.client.get_table(f"{self.project}.{self.dataset}.{table}")
        rows = self.client.list_rows(table_ref)
        df = rows.to_dataframe(bqstorage_client=self._storage_client)

        # append null columns with the provided names
        for nan_col in nan_columns:
            if nan_col not in df.columns:
                df[nan_col] = np.nan

        return df