From 402aabfe19f3857e9b467e0edbfd7da2160842f2 Mon Sep 17 00:00:00 2001 From: Nandita Koppisetty Date: Fri, 3 May 2024 17:26:23 -0700 Subject: [PATCH] Fix: Changing pivot to pivot_table to support aggregation (#376) Explain what this PR does. Changing pivot to pivot_table to support aggregation --------- Signed-off-by: Nandita Koppisetty --- numalogic/connectors/druid/_druid.py | 6 ++++-- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/numalogic/connectors/druid/_druid.py b/numalogic/connectors/druid/_druid.py index 20753abc..349c46eb 100644 --- a/numalogic/connectors/druid/_druid.py +++ b/numalogic/connectors/druid/_druid.py @@ -199,10 +199,11 @@ def fetch( if pivot: pivoted_frames = [] for column in pivot.columns: - _df = df.pivot( + _df = df.pivot_table( index=pivot.index, columns=[column], values=pivot.value, + aggfunc="sum" ) pivoted_frames.append(_df) @@ -304,10 +305,11 @@ def chunked_fetch( if pivot: pivoted_frames = [] for column in pivot.columns: - _df = df.pivot( + _df = df.pivot_table( index=pivot.index, columns=[column], values=pivot.value, + aggfunc="sum" ) pivoted_frames.append(_df) diff --git a/pyproject.toml b/pyproject.toml index 58978327..04402743 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "numalogic" -version = "0.9.1a9" +version = "0.9.1a10" description = "Collection of operational Machine Learning models and tools." authors = ["Numalogic Developers"] packages = [{ include = "numalogic" }]