Skip to content

Commit fa98b29

Browse files
committed
FIX: Fix pandas 3.0 issues
1 parent 845098a commit fa98b29

4 files changed

Lines changed: 12 additions & 16 deletions

File tree

databento/common/dbnstore.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,8 +1528,7 @@ def _format_px(
15281528

15291529
if price_type == PriceType.DECIMAL:
15301530
df[px_fields] = (
1531-
df[px_fields].replace(UNDEF_PRICE, np.nan).applymap(decimal.Decimal)
1532-
/ FIXED_PRICE_SCALE
1531+
df[px_fields].replace(UNDEF_PRICE, np.nan).map(decimal.Decimal) / FIXED_PRICE_SCALE
15331532
)
15341533
elif price_type == PriceType.FLOAT:
15351534
df[px_fields] = df[px_fields].replace(UNDEF_PRICE, np.nan) / FIXED_PRICE_SCALE

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ pytest = "^7.4.2"
5151
pytest-asyncio = "==0.21.1"
5252
ruff = "^0.0.291"
5353
types-requests = "^2.30.0.0"
54-
tomli = "^2.0.1"
5554
teamcity-messages = "^1.32"
56-
types-pytz = "^2024.1.0.20240203"
57-
types-aiofiles = "^23.2.0.20240403"
5855

5956
[build-system]
6057
requires = ["poetry-core"]

tests/test_historical_bento.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
from typing import Any
99
from typing import Literal
1010
from unittest.mock import MagicMock
11+
from zoneinfo import ZoneInfo
1112

1213
import numpy as np
1314
import pandas as pd
1415
import pytest
15-
import pytz
1616
import zstandard
1717
from databento_dbn import Compression
1818
from databento_dbn import DBNRecord
@@ -1579,24 +1579,24 @@ def test_dbnstore_to_df_with_timezone(
15791579
@pytest.mark.parametrize(
15801580
"timezone",
15811581
[
1582-
pytz.timezone("US/Central"),
1583-
pytz.timezone("US/Eastern"),
1584-
pytz.timezone("Europe/Vienna"),
1585-
pytz.timezone("Asia/Dubai"),
1586-
pytz.timezone("UTC"),
1582+
ZoneInfo("US/Central"),
1583+
ZoneInfo("US/Eastern"),
1584+
ZoneInfo("Europe/Vienna"),
1585+
ZoneInfo("Asia/Dubai"),
1586+
ZoneInfo("UTC"),
15871587
],
15881588
)
15891589
@pytest.mark.parametrize(
15901590
"schema",
15911591
[pytest.param(schema, id=str(schema)) for schema in Schema.variants()],
15921592
)
1593-
def test_dbnstore_to_df_with_pytz_timezone(
1593+
def test_dbnstore_to_df_with_zoneinfo(
15941594
test_data_path: Callable[[Dataset, Schema], Path],
15951595
schema: Schema,
1596-
timezone: pytz.BaseTzInfo,
1596+
timezone: ZoneInfo,
15971597
) -> None:
15981598
"""
1599-
Test that setting the `tz` parameter in `DBNStore.to_df` accepts `pytz`
1599+
Test that setting the `tz` parameter in `DBNStore.to_df` accepts `ZoneInfo`
16001600
timezone objects.
16011601
"""
16021602
# Arrange

tests/test_release.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from datetime import date
88

99
import pytest
10-
import tomli
10+
import tomllib
1111

1212
import databento
1313
from tests import PROJECT_ROOT
@@ -43,7 +43,7 @@ def fixture_pyproject_version() -> str:
4343
"""
4444
# Arrange, Act, Assert
4545
with open(PROJECT_ROOT / "pyproject.toml", "rb") as pyproject:
46-
data = tomli.load(pyproject)
46+
data = tomllib.load(pyproject)
4747
return data["project"]["version"]
4848

4949

0 commit comments

Comments
 (0)