From 02564efc8a0d86dbbdf71965e024ddeb1c6fbb2b Mon Sep 17 00:00:00 2001 From: Maxence Dolle Date: Thu, 3 Aug 2017 16:06:35 +0200 Subject: [PATCH] Improve performance on dataframe to line conversion --- influxdb/_dataframe_client.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/influxdb/_dataframe_client.py b/influxdb/_dataframe_client.py index ac110a4a..b753bb33 100644 --- a/influxdb/_dataframe_client.py +++ b/influxdb/_dataframe_client.py @@ -302,17 +302,10 @@ def _convert_dataframe_to_lines(self, tag_df = self._stringify_dataframe( tag_df, numeric_precision, datatype='tag') - # prepend tag keys - tag_df = tag_df.apply( - lambda s: s.apply( - lambda v, l: l + '=' + v if v else None, l=s.name)) - - # join tags, but leave out None values + # join preprendded tags, leaving None values out tags = tag_df.apply( - lambda r: ','.join(r.dropna()), axis=1) - - # prepend comma - tags = tags.apply(lambda v: ',' + v if v else '') + lambda s: [',' + s.name + '=' + v if v else '' for v in s]) + tags = tags.sum(axis=1) del tag_df else: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy