Skip to content

Commit

Permalink
Assume naive datetimes to be UTC
Browse files Browse the repository at this point in the history
Assume UTC when converting incoming datetimes into pandas dataframes.
  • Loading branch information
bloomonkey committed Aug 23, 2023
1 parent 7f7e482 commit eb2064f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Adapt to pydantic 2.x API changes
- Assume naive datetimes to be UTC

## [0.6.1] - 2023-08-23
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion fastapi_mlflow/predictors.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def request_to_dataframe(request: Request) -> pd.DataFrame:
if item["type"] in ("integer", "int32"):
df[item["name"]] = df[item["name"]].astype(np.int32)
elif item["type"] == "datetime":
df[item["name"]] = pd.to_datetime(df[item["name"]])
df[item["name"]] = pd.to_datetime(df[item["name"]], utc=True)
else:
df[item["name"]] = df[item["name"]].astype(
MLFLOW_SIGNATURE_TO_PYTHON_TYPE_MAP.get(item["type"], object)
Expand Down

0 comments on commit eb2064f

Please sign in to comment.