Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Understanding how to write pandas DF with tags, to influxDB #510

Closed
@laimaretto

Description

@laimaretto

Hi. I have a [3526 rows x 5 columns] DF. This is a snippet of it.

                        0             1                  2         3      4
0     2017-09-29 22:41:51     10.2.95.5   C1195_LF470_SARF   0.0.1.1  11993
1     2017-09-29 22:41:37     10.2.52.7   CF643_RCZ70_SARM  0.0.1.16  12102
2     2017-09-29 22:41:39    10.2.102.7   C1345_BQS70_SARF  0.0.1.17  18173
3     2017-09-29 22:41:41   10.2.23.212   CN165_FS470_SAR8   0.0.0.7  23525
4     2017-09-29 22:41:38     10.2.96.4   CF832_UY570_SARM   0.0.1.4   6162

So column 0 is the index(time), columns 1, 2 and 3 should be tags, and column 4 is my value.

I've inserted previously points into influxdb by using a dictionary, such as ...

bodyDB = [{
	"measurement": tbName,
	"tags":
	{
		"col1": col1,
		"col2": col2,
		"col3": col3
	},
	"time": col0,
	"fields":
	{
		"col4": col4
	}
}]

How can I accomplish the same but, instead of using the write_points(bodyDB), issuing the same with the DF? I don't understand how to tell the write_points() which column is index, which are tags and which is value?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions