From 9c2ae576ffefb4eb91c1e793a5cc1cbefd03e8f7 Mon Sep 17 00:00:00 2001 From: Johan Polson <99672670+mb-jp@users.noreply.github.com> Date: Fri, 16 Aug 2024 10:45:33 +0200 Subject: [PATCH] FIx for GetAllVintageSeriesResult.to_pd_data_frame (#67) --- .../common/types/get_all_vintage_series_result.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/macrobond_data_api/common/types/get_all_vintage_series_result.py b/macrobond_data_api/common/types/get_all_vintage_series_result.py index 264fea64..adf4ea16 100644 --- a/macrobond_data_api/common/types/get_all_vintage_series_result.py +++ b/macrobond_data_api/common/types/get_all_vintage_series_result.py @@ -1,4 +1,5 @@ from dataclasses import dataclass +from itertools import chain from typing import TYPE_CHECKING, Any, Dict, Sequence, overload, List @@ -36,9 +37,12 @@ def to_pd_data_frame(self) -> "DataFrame": """ import pandas # pylint: disable=import-outside-toplevel + dates = list(set(chain.from_iterable((x.dates for x in self.series)))) + dates.sort() + df = pandas.DataFrame( { - **{"date": self.series[len(self.series) - 1].dates}, + **{"date": dates}, } )