Skip to content

Commit 046b219

Browse files
authored
Merge pull request influxdata#486 from Realytics/master
Improve performance on dataframe to line conversion
2 parents 87683f4 + 02564ef commit 046b219

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

influxdb/_dataframe_client.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,17 +302,10 @@ def _convert_dataframe_to_lines(self,
302302
tag_df = self._stringify_dataframe(
303303
tag_df, numeric_precision, datatype='tag')
304304

305-
# prepend tag keys
306-
tag_df = tag_df.apply(
307-
lambda s: s.apply(
308-
lambda v, l: l + '=' + v if v else None, l=s.name))
309-
310-
# join tags, but leave out None values
305+
# join preprendded tags, leaving None values out
311306
tags = tag_df.apply(
312-
lambda r: ','.join(r.dropna()), axis=1)
313-
314-
# prepend comma
315-
tags = tags.apply(lambda v: ',' + v if v else '')
307+
lambda s: [',' + s.name + '=' + v if v else '' for v in s])
308+
tags = tags.sum(axis=1)
316309

317310
del tag_df
318311
else:

0 commit comments

Comments
 (0)
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