Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.68.1 - 2025-12-16

#### Enhancements
- Improved the performance of `DBNStore.to_df()` symbol mapping

## 0.68.0 - 2025-12-09

This release adds support for Python 3.14.
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
info@nautechsystems.io.
support@databento.com.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down
21 changes: 7 additions & 14 deletions databento/common/dbnstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ def _transcode(
) -> None:
if map_symbols:
self._instrument_map.insert_metadata(self.metadata)
symbol_map = self._instrument_map._data
symbol_map = self._instrument_map.build_symbol_map()
else:
symbol_map = None

Expand All @@ -1299,7 +1299,7 @@ def _transcode(
pretty_ts=pretty_ts,
has_metadata=True,
map_symbols=map_symbols,
symbol_interval_map=symbol_map, # type: ignore [arg-type]
symbol_interval_map=symbol_map,
schema=schema,
)

Expand Down Expand Up @@ -1508,19 +1508,12 @@ def _format_hidden_fields(self, df: pd.DataFrame) -> None:
def _format_map_symbols(self, df: pd.DataFrame) -> None:
# the first ordered field will be ts_recv or ts_event when appropriate
ts_name = self._struct_type._ordered_fields[0]
dates = df[ts_name] if self._pretty_ts else pd.to_datetime(df[ts_name], utc=True).dt.date

if df.empty:
df["symbol"] = []
else:
df["symbol"] = df.apply(
lambda r: self._instrument_map.resolve(
r["instrument_id"],
(
r[ts_name] if self._pretty_ts else pd.to_datetime(r[ts_name], utc=True)
).date(),
),
axis=1,
)
df["symbol"] = self._instrument_map.resolve_many(
df["instrument_id"].to_numpy(),
np.asarray(dates, dtype="datetime64[D]"),
)

def _format_timezone(self, df: pd.DataFrame) -> None:
for field in self._struct_type._timestamp_fields:
Expand Down
Loading