From 5a614a55695d650b966cb9ec3183a792d802a2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Uzna=C5=84ski?= Date: Thu, 8 Feb 2024 11:09:37 +0100 Subject: [PATCH] cleanup of apply and unpack (#5626) * cleanup of apply and unpack * Update public/pathway/python/pathway/internals/expression.py * Update public/pathway/python/pathway/internals/expression.py * Update public/pathway/python/pathway/internals/expression.py * Update public/pathway/python/pathway/internals/expression.py GitOrigin-RevId: e3af24d480f25f3aaf31f9422a162f68d9e44828 --- .../pipelines/unstructured_to_sql_on_the_fly/app.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/pipelines/unstructured_to_sql_on_the_fly/app.py b/examples/pipelines/unstructured_to_sql_on_the_fly/app.py index 2e65785..83ad6aa 100644 --- a/examples/pipelines/unstructured_to_sql_on_the_fly/app.py +++ b/examples/pipelines/unstructured_to_sql_on_the_fly/app.py @@ -98,6 +98,7 @@ could be a nice next step to detect and possibly correct outliers. """ + import json import logging import os @@ -234,11 +235,10 @@ def structure_on_the_fly( responses = responses.select(values=parse_str_to_list(pw.this.result)) result = unpack_col(responses.values, *sorted(FinancialStatementSchema.keys())) - result = result.select( - *pw.this.without(pw.this.eps, pw.this.net_income_md, pw.this.revenue_md), - eps=pw.apply_with_type(float, float, pw.this.eps), - net_income_md=pw.apply_with_type(float, float, pw.this.net_income_md), - revenue_md=pw.apply_with_type(float, float, pw.this.revenue_md), + result = result.with_columns( + eps=pw.apply(float, pw.this.eps), + net_income_md=pw.apply(float, pw.this.net_income_md), + revenue_md=pw.apply(float, pw.this.revenue_md), ) return result