mirror of
https://gitlab.com/lander-team/air-prop-simulation.git
synced 2025-07-23 22:51:35 +00:00
34 lines
1017 B
Python
34 lines
1017 B
Python
from datetime import datetime
|
|
import pandas as pd
|
|
from influxdb_client import InfluxDBClient, Point, WritePrecision
|
|
from influxdb_client.client.write_api import SYNCHRONOUS
|
|
import influxdb_client
|
|
from tqdm import tqdm
|
|
|
|
# You can generate a Token from the "Tokens Tab" in the UI
|
|
token = "RKOjpFKD2e9EUy79rB6pQEYmgmKaGnMy-4hMDnQ_pamEbrrfsMhcP2LjU7ufTRBSyFtRBSKVW5RnET6wq6qOag=="
|
|
org = "anson@ansonbiggs.com"
|
|
bucket = "anson's Bucket"
|
|
|
|
client = InfluxDBClient(
|
|
url="https://westeurope-1.azure.cloud2.influxdata.com", token=token
|
|
)
|
|
write_api = client.write_api(write_options=SYNCHRONOUS)
|
|
|
|
df = pd.read_csv("thrustdata.csv")
|
|
|
|
ps = []
|
|
for i, row in tqdm(df.iterrows(), total=len(df)):
|
|
data = dict(row)
|
|
ps.append(
|
|
influxdb_client.Point("my_measurement")
|
|
.tag("Thrust", "Test")
|
|
.field("Thrust", data["Thrust"])
|
|
.field("Pressure", data["Pressure"])
|
|
.field("Time", data["Time"])
|
|
.field("Mass", data["Mass"])
|
|
)
|
|
|
|
|
|
write_api.write(bucket=bucket, org=org, record=ps)
|