impot data from pandas dataframe to influxdb, but only get a measurement name, fields get nothing

52 Views Asked by At
for index, row in df.iterrows():
    point = Point("measurement2") \
        .time(index, WritePrecision.NS)\
        .tag("tag_key", "1") \
        .field("hex", row["hex"]) \
        .field("PT4_BMS_Bat_Int_Res_Chrg_ST3", row["PT4_BMS_Bat_Int_Res_Chrg_ST3"]) \
        .field("PT4_BMS_Bat_Int_Res_Dschrg_ST3", row["PT4_BMS_Bat_Int_Res_Dschrg_ST3"]) \
        .field("PT4_BMS_Bat_SOC_Max_ST3", row["PT4_BMS_Bat_SOC_Max_ST3"]) \
        .field("PT4_BMS_Bat_SOC_Min_ST3", row["PT4_BMS_Bat_SOC_Min_ST3"]) \
        .field("PT4_BMS_Bat_SOC_ST3", row["PT4_BMS_Bat_SOC_ST3"]) \
        
    print(index)
    print(row["PT4_BMS_Bat_Int_Res_Chrg_ST3"])

    

    # import data
    write_api.write(bucket=bucket, org="benz", record=point)
    time.sleep(1) # separate points by 1 second

here is my dataframe

print(df.to_dict())

{'hex': {Timestamp('2023-07-15 08:40:26.055830016'): '390e022affffffffffffffffffff0f80ffffffffffffffffffffffffffffffffff470628c8e9ffffffff2a5867f00000', Timestamp('2023-07-15 08:40:27.056139008'): '390e022a69005900090bc15eda8f9e824146444f4a27c69d0581d790b6a3f8d7bc430628c8e9ffffffff952479340000', Timestamp('2023-07-15 08:40:28.056162048'): '390e022a69005900090bc15eda8f9e824146444f4a27c69d0581d790b6a3f8d7bc430628c8e9fffffffff915c4c50000', Timestamp('2023-07-15 08:40:29.056018944'): '390e022a69005900090bc15eda8f9e824146444f4a27c69d0581d790b6a3f8d7bc430628c8e9ffffffff5d9504930000', Timestamp('2023-07-15 08:40:30.056163072'):

there is no error output,but the fields still have no data

0

There are 0 best solutions below