As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

API Reference

Pandas Data Types for SQL systems (BigQuery, Spanner)

class db_dtypes.DateArray(values, dtype=None, copy: bool = False)[source]

Pandas array type containing date data

__arrow_array__(type=None)[source]

Convert to an Arrow array from dbdate data.

See: https://pandas.pydata.org/pandas-docs/stable/development/extending.html#compatibility-with-apache-arrow

astype(dtype, copy=True)[source]

Cast to a NumPy array or ExtensionArray with ‘dtype’.

Parameters
  • dtype (str or dtype) – Typecode or data-type to which the array is cast.

  • copy (bool, default True) – Whether to copy the data, even if not necessary. If False, a copy is made only if the old dtype does not match the new dtype.

Returns

array – An ExtensionArray if dtype is ExtensionDtype, Otherwise a NumPy ndarray with ‘dtype’ for its dtype.

Return type

np.ndarray or ExtensionArray

class db_dtypes.DateDtype[source]

Extension dtype for time data.

static __from_arrow__(array: Union[pyarrow.lib.Array, pyarrow.lib.ChunkedArray])db_dtypes.DateArray[source]

Convert to dbdate data from an Arrow array.

See: https://pandas.pydata.org/pandas-docs/stable/development/extending.html#compatibility-with-apache-arrow

construct_array_type()[source]

Return the array type associated with this dtype.

Returns

Return type

type

type

alias of datetime.date

class db_dtypes.TimeArray(values, dtype=None, copy: bool = False)[source]

Pandas array type containing time data

__arrow_array__(type=None)[source]

Convert to an Arrow array from dbtime data.

See: https://pandas.pydata.org/pandas-docs/stable/development/extending.html#compatibility-with-apache-arrow

astype(dtype, copy=True)[source]

Cast to a NumPy array or ExtensionArray with ‘dtype’.

Parameters
  • dtype (str or dtype) – Typecode or data-type to which the array is cast.

  • copy (bool, default True) – Whether to copy the data, even if not necessary. If False, a copy is made only if the old dtype does not match the new dtype.

Returns

array – An ExtensionArray if dtype is ExtensionDtype, Otherwise a NumPy ndarray with ‘dtype’ for its dtype.

Return type

np.ndarray or ExtensionArray

class db_dtypes.TimeDtype[source]

Extension dtype for time data.

static __from_arrow__(array: Union[pyarrow.lib.Array, pyarrow.lib.ChunkedArray])db_dtypes.TimeArray[source]

Convert to dbtime data from an Arrow array.

See: https://pandas.pydata.org/pandas-docs/stable/development/extending.html#compatibility-with-apache-arrow

construct_array_type()[source]

Return the array type associated with this dtype.

Returns

Return type

type

type

alias of datetime.time