I have a Influx Bucket where I want to upload a predictions time series dataset for each id_number, the predictions for each goes 2 months in the future.
The thing is that everytime I try to upload it with the Influx UI it return me the error:
"Failed to upload the selected CSV: error in csv.from(): failed to read metadata: failed to read header row: wrong number of fields"
The dataset looks like this:
#datatype,dateTime:RFC3339,double,string
#group,false,false,false
#default,,,
date,trend,id_Number
2024-05-24T00:00:00Z,142.49524140527743,159345
2024-05-25T00:00:00Z,143.06121931128922,159345
2024-05-26T00:00:00Z,143.62719721730102,159345
2024-05-27T00:00:00Z,144.1931751233128,159345
2024-05-28T00:00:00Z,144.75915302932464,159345
2024-05-29T00:00:00Z,145.32513095717914,159345
2024-05-30T00:00:00Z,145.89110888503367,159345
2024-05-31T00:00:00Z,146.45708681288818,159345
2024-06-01T00:00:00Z,147.02306474074268,159345
Besides that I trying to create an script in python to upload the file into a bucket but everytime i try it the data is not uploaded unless I delete the ".time(iso_timestamp)"
def write_dataframe(self, df: pd.DataFrame, measurement: str, tag_columns: Optional[list] = None):
if tag_columns is None:
tag_columns = ["id_Number"]
required_columns = {"date", "trend", "id_Number"}
points = []
for _, row in df.iterrows():
meter_number = str(row["id_Number"]) if pd.notna(row["id_Number"]) else "unknown"
trend = float(row["trend"])
timestamp = row["date"]
if pd.isna(timestamp):
print(f"Skipping row due to invalid timestamp: {row['date']}")
continue
iso_timestamp = timestamp.isoformat()
point = (
Point(measurement)
.tag("id_Number", meter_number)
.field("trend", trend)
.time(iso_timestamp)
)
points.append(point)
Any thoughts would be greatly appreciated. Thanks.