-
Notifications
You must be signed in to change notification settings - Fork 187
Closed
Description
Dear Great Maintainer,
I would like to request to transfer feature which is currently in Influxdb 1.7 to 2.0.
There are 2 proposals:
- Transfer DataFrameClient from 1.7 to 2
In the version 1.7, function DataFrameClient allows to insert the dataframe to idb.
import pandas as pd
from influxdb import DataFrameClient
dbConnDF = DataFrameClient('localhost', '8086', 'd', 'password', 'securities')
df = pd.read_parquet('/home/d/fi/01_Data/01_raw_data/qd.parquet').set_index('date').sort_values()
%time dbConnDF.write_points(df, 'securities', tag_columns=['symbol'], protocol="json", batch_size=10000)
%time d = dbConnDF.query("select * from securities")
d['securities']
- Create some helping function to change dataframe to format readable for influxdb 2
@Anaisdg created the function below.
https://github.com/Anaisdg/Influx_Pandas
**`import pandas as pd
import time
from datetime import datetime
def lp(df,measurement,tag_key,field,value,datetime):
lines= [str(df[measurement][d]) + ","
+ str(tag_key) + "=" + str(df[tag_key][d])
+ " " + str(df[field][d]) + "=" + str(df[value][d])
+ " " + str(int(time.mktime(df[datetime][d].timetuple()))) + "000000000" for d in range(len(df))]
return lines`**
Thank you in advance for your help it will save a lot of time to your customers
Sutyke
joconnor-ecaa and lifeisawavesorideit
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request