Skip to content

Commit a3128aa

Browse files
authored
VER: Release 0.68.1
See release notes.
2 parents 3401f62 + 71aaec2 commit a3128aa

File tree

7 files changed

+307
-110
lines changed

7 files changed

+307
-110
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.68.1 - 2025-12-16
4+
5+
#### Enhancements
6+
- Improved the performance of `DBNStore.to_df()` symbol mapping
7+
38
## 0.68.0 - 2025-12-09
49

510
This release adds support for Python 3.14.

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ representative at an online or offline event.
6060

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

6666
All community leaders are obligated to respect the privacy and security of the

databento/common/dbnstore.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ def _transcode(
12871287
) -> None:
12881288
if map_symbols:
12891289
self._instrument_map.insert_metadata(self.metadata)
1290-
symbol_map = self._instrument_map._data
1290+
symbol_map = self._instrument_map.build_symbol_map()
12911291
else:
12921292
symbol_map = None
12931293

@@ -1299,7 +1299,7 @@ def _transcode(
12991299
pretty_ts=pretty_ts,
13001300
has_metadata=True,
13011301
map_symbols=map_symbols,
1302-
symbol_interval_map=symbol_map, # type: ignore [arg-type]
1302+
symbol_interval_map=symbol_map,
13031303
schema=schema,
13041304
)
13051305

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

1512-
if df.empty:
1513-
df["symbol"] = []
1514-
else:
1515-
df["symbol"] = df.apply(
1516-
lambda r: self._instrument_map.resolve(
1517-
r["instrument_id"],
1518-
(
1519-
r[ts_name] if self._pretty_ts else pd.to_datetime(r[ts_name], utc=True)
1520-
).date(),
1521-
),
1522-
axis=1,
1523-
)
1513+
df["symbol"] = self._instrument_map.resolve_many(
1514+
df["instrument_id"].to_numpy(),
1515+
np.asarray(dates, dtype="datetime64[D]"),
1516+
)
15241517

15251518
def _format_timezone(self, df: pd.DataFrame) -> None:
15261519
for field in self._struct_type._timestamp_fields:

0 commit comments

Comments
 (0)