Table.to_dataframe
This method is deprecated, in favor of the more explicit to_pandas_dataframe
and to_geopandas_dataframe methods.
Note that the new methods use the "pyarrow"
dtype backend by default, while the deprecated to_dataframe
method uses "numpy"
dtypes. While most code will be unaffected, if you rely on numpy datatypes, you can call to_pandas_dataframe(dtype_backend="numpy")
to replicate the behavior of this method. Learn more >
Table.to_dataframe(max_results=None, *, variables=None, geography_variable="", progress=True) → pandas.DataFrame | geopandas.GeoDataFrame
Returns a representation of the table as a pandas or geopandas dataframe.
Parameters:
max_results
: int, default None
The maximum number of rows to return. If not specified, all rows in the table will be read.
variables
: list<str>, default None
A list of variable names to read, improving performance when not all variables are needed. If unspecified, all variables will be represented in the returned rows. Variable names are case-insensitive, though the names in the results will reflect the variable's true casing. The order of the columns returned will correspond to the order of names in this list.
geography_variable
: str, default ""
Only relevant if one of your variables is of type "geography". The variable to use as the geopandas geometry. If an empty string, the first geography variable in the dataframe will be used. If set to None
, a normal pandas.DataFrame will be returned instead, with all geography variables stored as their WKT string representation.
progress
: bool, default True
Whether to show a progress bar.
Returns:
pandas.DataFrame | geopandas.GeoDataFrame
Notes:
The returned dataframe will use numpy dtypes for its backend. Learn more about pandas dtypes and type conversions >
Last updated