Hello,
I have been all over trying to solve why I can get the columns of my pandas dataframe into influxdb cloud but no data points. I have files with 100,000+ lines I would like to be able to upload. Please provide assistance in making the pandas dataframe upload to influxdb. Code and data sample below.
from influxdb_client.client.write_api import SYNCHRONOUS
from influxdb_client.extras import pd, np
import influxdb_client, os, time
def create_pd(file):
header = [
"Node", "RWindDirection", "RWindSpeed", "CWindDirection",
"ARWindDirection",
"ARWindSpeed", "RGustDirection", "RGustSpeed",
"ACWindDirection",
"WSStatus", "Pressure", "PressureSea", "PressureStation", "RelativeHumidity",
"Temperature", "Dewpoint", "Absolute Humidity", "compassHeading"]
df = pd.read_csv(file,names = header)
return df
df = create_pd(last_file)
# Intializing database
write_client = influxdb_client.InfluxDBClient(url=url, token=token, org=org,debug=False)
write_api = write_client.write_api(write_options=SYNCHRONOUS) # Define the write api
write_api.write(bucket=bucket, data=df, data_frame_measurement_name=str(last_file[-8:]),
data_frame_tag_columns=['header'],debug=False)
Sample of the data
Q,161,000.05,274,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.63,113
Q,157,000.04,270,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.63,113
Q,158,000.04,271,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.3,04.64,113
Q,171,000.03,284,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.3,04.64,113
Q,165,000.02,278,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.62,113
Q,121,000.03,234,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.62,113
Q,131,000.03,244,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.62,113
Q,133,000.04,246,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.62,113
Q,140,000.04,253,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.62,113
Q,128,000.02,241,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.62,113
Q,172,000.05,285,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.62,113
Q,176,000.02,289,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.62,113
Q,076,000.02,189,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.61,113
Q,093,000.02,206,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,070,+004.5,-000.4,04.61,113
Q,107,000.03,220,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.4,04.60,113
Q,055,000.02,168,090,000.01,161,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.60,113
Q,121,000.01,235,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.4,04.60,114
Q,103,000.03,216,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.60,113
Q,089,000.03,202,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.59,113
Q,064,000.04,177,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.59,113
Q,047,000.03,160,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.59,113
Q,036,000.03,149,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.59,113
Q,044,000.01,157,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.59,113
Q,038,000.01,151,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.59,113
Q,188,000.02,301,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.58,113
Q,173,000.04,286,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.58,113
Q,156,000.01,269,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.58,113
Q,154,000.01,267,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.58,113
Q,187,000.03,300,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.58,113
Q,173,000.01,286,090,000.01,180,000.06,000,0000,0709.0,0709.0,0709.0,069,+004.5,-000.5,04.58,113