Here a dataframe for stock XYZ:
timestamp open high low close volume
timestamp
2021-02-04 04:21:00 2021-02-04 04:21:00 1.41 1.41 1.41 1.4100 100.0
2021-02-04 04:22:00 2021-02-04 04:22:00 1.41 1.41 1.41 1.4100 1100.0
2021-02-04 04:23:00 2021-02-04 04:23:00 1.41 1.41 1.40 1.4000 200.0
2021-02-04 04:27:00 2021-02-04 04:27:00 1.40 1.40 1.40 1.4000 1010.0
2021-02-04 04:28:00 2021-02-04 04:28:00 1.40 1.40 1.40 1.4000 2000.0
... ... ... ... ... ... ...
2021-02-04 19:55:00 2021-02-04 19:55:00 9.85 9.90 9.77 9.7700 9799.0
2021-02-04 19:56:00 2021-02-04 19:56:00 9.76 9.93 9.76 9.8501 24665.0
2021-02-04 19:57:00 2021-02-04 19:57:00 9.95 9.97 9.91 9.9200 7544.0
2021-02-04 19:58:00 2021-02-04 19:58:00 9.97 10.09 9.94 9.9500 21250.0
2021-02-04 19:59:00 2021-02-04 19:59:00 10.06 10.09 9.95 10.0900 26640.0
I am trying to write this dataframe into influxdb2 bucket using this function:
def get_stock_data(symbol):
points = []
for i in range(len(df)):
point = Point(measurement_name="XYZ").time(pd.Timestamp(df.index[i]).isoformat())
point.field("open", df["open"][i])
point.field("high", df["high"][i])
point.field("low", df["low"][i])
point.field("close", df["close"][i])
point.field("volume", df["volume"][i])
point.tag("my_tag", "my_tag_value")
points.append(point)
return points
I know it is working partially because I can see the measurement XYZ, but I can't see the fields and field values in the influxdb ui or Grafana. I tried many thing as modifying the timestamp, reinstalling influxdb2, etc. Why the fields and field values are not pushed into the bucket?