Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add how-to guide and include API reference (#33)
* docs: add how-to guide and include API reference * fix indentation * fix types in sample * fix types in sample
- Loading branch information
Showing
8 changed files
with
112 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
API Reference | ||
^^^^^^^^^^^^^ | ||
|
||
.. automodule:: db_dtypes.version | ||
.. automodule:: db_dtypes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../samples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
Using the db-dtypes package | ||
--------------------------- | ||
|
||
Importing the :mod:`db_dtypes` module registers the extension dtypes for use | ||
in pandas. | ||
|
||
Construct a date :class:`~pandas.Series` with strings in ``YYYY-MM-DD`` format | ||
or :class:`datetime.date` objects. | ||
|
||
.. literalinclude:: samples/snippets/pandas_date_and_time.py | ||
:language: python | ||
:dedent: 4 | ||
:start-after: [START bigquery_pandas_date_create] | ||
:end-before: [END bigquery_pandas_date_create] | ||
|
||
Working with dates | ||
^^^^^^^^^^^^^^^^^^ | ||
|
||
Convert a date :class:`~pandas.Series` to a ``datetime64`` Series with | ||
:meth:`~pandas.Series.astype`. The resulting values use midnight as the | ||
time part. | ||
|
||
.. literalinclude:: samples/snippets/pandas_date_and_time.py | ||
:language: python | ||
:dedent: 4 | ||
:start-after: [START bigquery_pandas_date_as_datetime] | ||
:end-before: [END bigquery_pandas_date_as_datetime] | ||
|
||
Just like ``datetime64`` values, date values can be subtracted. This is | ||
equivalent to first converting to ``datetime64`` and then subtracting. | ||
|
||
.. literalinclude:: samples/snippets/pandas_date_and_time.py | ||
:language: python | ||
:dedent: 4 | ||
:start-after: [START bigquery_pandas_date_sub] | ||
:end-before: [END bigquery_pandas_date_sub] | ||
|
||
Just like ``datetime64`` values, :class:`~pandas.tseries.offsets.DateOffset` | ||
values can be added to them. | ||
|
||
.. literalinclude:: samples/snippets/pandas_date_and_time.py | ||
:language: python | ||
:dedent: 4 | ||
:start-after: [START bigquery_pandas_date_add_offset] | ||
:end-before: [END bigquery_pandas_date_add_offset] | ||
|
||
|
||
Working with times | ||
^^^^^^^^^^^^^^^^^^ | ||
|
||
Construct a time :class:`~pandas.Series` with strings in ``HH:MM:SS.fraction`` | ||
24-hour format or :class:`datetime.time` objects. | ||
|
||
.. literalinclude:: samples/snippets/pandas_date_and_time.py | ||
:language: python | ||
:dedent: 4 | ||
:start-after: [START bigquery_pandas_time_create] | ||
:end-before: [END bigquery_pandas_time_create] | ||
|
||
Convert a time :class:`~pandas.Series` to a ``timedelta64`` Series with | ||
:meth:`~pandas.Series.astype`. | ||
|
||
.. literalinclude:: samples/snippets/pandas_date_and_time.py | ||
:language: python | ||
:dedent: 4 | ||
:start-after: [START bigquery_pandas_time_as_timedelta] | ||
:end-before: [END bigquery_pandas_time_as_timedelta] | ||
|
||
|
||
Combining dates and times | ||
^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Combine a date :class:`~pandas.Series` with a time :class:`~pandas.Series` to | ||
create a ``datetime64`` :class:`~pandas.Series`. | ||
|
||
.. literalinclude:: samples/snippets/pandas_date_and_time.py | ||
:language: python | ||
:dedent: 4 | ||
:start-after: [START bigquery_pandas_combine_date_time] | ||
:end-before: [END bigquery_pandas_combine_date_time] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters