Skip to content

ENH: Use tz-aware dtype for timestamp columns #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update min pandas to 0.23.0
This is the first version that passing a dtype of
pandas.api.types.DatetimeTZDtype(tz="UTC") to the Series constructor
actually works. I get "TypeError: data type not understood" in lower
versions.
  • Loading branch information
tswast committed Apr 3, 2019
commit 89be2207925d0cee66ee6185d4610f8ae8b7cc57
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ jobs:
- run: nox -s lint

# Conda
"conda-3.6-0.21.1":
"conda-3.6-0.23.0":
docker:
- image: continuumio/miniconda3
environment:
PYTHON: "3.6"
PANDAS: "0.21.1"
PANDAS: "0.23.0"
steps:
- checkout
- run: ci/config_auth.sh
Expand All @@ -65,4 +65,4 @@ workflows:
- "pip-3.6"
- "pip-3.7"
- lint
- "conda-3.6-0.21.1"
- "conda-3.6-0.23.0"
2 changes: 1 addition & 1 deletion ci/requirements-2.7.pip
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mock
pandas==0.20.0
pandas==0.23.0
google-auth==1.4.1
google-auth-oauthlib==0.0.1
google-cloud-bigquery==1.9.0
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements-3.5.pip
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pandas==0.20.0
pandas==0.23.0
google-auth==1.4.1
google-auth-oauthlib==0.0.1
google-cloud-bigquery==1.9.0
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Dependency updates

- Update the minimum version of ``google-cloud-bigquery`` to 1.9.0.
(:issue:`247`)
- Update the minimum version of ``pandas`` to 0.20.0. (:issue:`263`)
- Update the minimum version of ``pandas`` to 0.23.0. (:issue:`263`)

Internal changes
~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def readme():

INSTALL_REQUIRES = [
"setuptools",
"pandas>=0.20.0",
"pandas>=0.23.0",
"pydata-google-auth",
"google-auth",
"google-auth-oauthlib",
Expand Down
14 changes: 10 additions & 4 deletions tests/system/test_gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def test_should_properly_handle_timestamp_unix_epoch(self, project_id):
df,
DataFrame(
{"unix_epoch": ["1970-01-01T00:00:00.000000Z"]},
dtype="datetime64[ns]",
dtype=pandas.api.types.DatetimeTZDtype(tz="UTC"),
),
)

Expand All @@ -330,7 +330,7 @@ def test_should_properly_handle_arbitrary_timestamp(self, project_id):
df,
DataFrame(
{"valid_timestamp": ["2004-09-15T05:00:00.000000Z"]},
dtype="datetime64[ns]",
dtype=pandas.api.types.DatetimeTZDtype(tz="UTC"),
),
)

Expand Down Expand Up @@ -403,7 +403,11 @@ def test_should_properly_handle_null_timestamp(self, project_id):
dialect="legacy",
)
tm.assert_frame_equal(
df, DataFrame({"null_timestamp": [NaT]}, dtype="datetime64[ns]")
df,
DataFrame(
{"null_timestamp": [NaT]},
dtype=pandas.api.types.DatetimeTZDtype(tz="UTC"),
),
)

def test_should_properly_handle_null_datetime(self, project_id):
Expand Down Expand Up @@ -589,7 +593,9 @@ def test_zero_rows(self, project_id):
"title": pandas.Series([], dtype=object),
"id": pandas.Series([], dtype=np.dtype(int)),
"is_bot": pandas.Series([], dtype=np.dtype(bool)),
"ts": pandas.Series([], dtype="datetime64[ns]"),
"ts": pandas.Series(
[], dtype=pandas.api.types.DatetimeTZDtype(tz="UTC")
),
}
expected_result = DataFrame(
empty_columns, columns=["title", "id", "is_bot", "ts"]
Expand Down