Skip to content

Commit

Permalink
PLAT-1037 Fix type casting for coin_metrics_id
Browse files Browse the repository at this point in the history
This MR fixes the occasional bug where coin_metrics_id is a string
  • Loading branch information
Victor Ramirez committed Sep 19, 2024
1 parent e21ebb4 commit 07bc2cf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions coinmetrics/_data_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from coinmetrics._exceptions import CoinMetricsClientNotFoundError
if TYPE_CHECKING:
from coinmetrics.api_client import CoinMetricsClient
import numpy as np

orjson_found = True
try:
Expand Down Expand Up @@ -285,6 +286,8 @@ def to_dataframe(
)
if dtype_mapper is None:
df = df.convert_dtypes()
if df.dtypes.get("coin_metrics_id") == np.dtype("object"):
df["coin_metrics_id"] = df["coin_metrics_id"].astype(np.float128)
if header is not None:
assert len(df.columns) == len(
header
Expand Down

0 comments on commit 07bc2cf

Please sign in to comment.