How to Dump CSV File Into Influxdb Using Python Code.

from influxdb import InfluxDBClient 
import pandas as pd

client = InfluxDBClient('localhost', 8086, 'root', 'root', 'dbname')

file_name=open("local system file path")
csv_reader=pd.read_csv(file_name)

for y in csv_reader.iterrows():
        sid = y [1][0]
        name=
        node=
        nodeid = y[1][1]
        sensorid = y [1][2]
        status = y[1][3]


json_body = [
            {
                "measurement": "feeddata",
                "tags": {
                        # 'name':name,
                        # 'node': node,
                        },
                # "time": time,
                "fields": {
                    'sid':sid,
                    'nodeid':nodeid,
                    'sensorid':sensorid,
                   
                        }
            }
        ]
 client.write_points(json_body)

//for loop up here







Comments

Popular posts from this blog

How to Connect Firebase Using Pyrebase In Python

How to get Full URL or get absolute url In Django

How To Convert Html File/URL/String Into Image Using Python