@@ -18,8 +18,10 @@ Please take a moment to review the following client docs:
18
18
- [ Initializing Client] ( #initializing-client )
19
19
- [ Creating Database/Bucket] ( #creating-databasebucket )
20
20
- [ Dropping Database/Bucket] ( #dropping-databasebucket )
21
- - [ Writing LineProtocol] ( #writing-lineprotocol )
22
- - [ Writing Dictionary-style object] ( #writing-dictionary-style-object )
21
+ - Writes
22
+ - [ LineProtocol] ( #writing-lineprotocol )
23
+ - [ Dictionary-style object] ( #writing-dictionary-style-object )
24
+ - [ Pandas DataFrame] ( #writing-pandas-dataframe )
23
25
24
26
## Initializing Client
25
27
@@ -191,6 +193,43 @@ with InfluxDBClient(url='http://localhost:8086', token='my-token', org='my-org')
191
193
``` python
192
194
```
193
195
196
+ ## Writing Pandas DataFrame
197
+
198
+ ** influxdb-python**
199
+
200
+ ``` python
201
+ import pandas as pd
202
+
203
+ from influxdb import InfluxDBClient
204
+
205
+ df = pd.DataFrame(data = list (range (30 )),
206
+ index = pd.date_range(start = ' 2014-11-16' , periods = 30 , freq = ' H' ),
207
+ columns = [' 0' ])
208
+
209
+ client = InfluxDBClient(host = ' 127.0.0.1' , port = 8086 , username = ' root' , password = ' root' , database = ' dbname' )
210
+
211
+ client.write_points(df, ' demo' , protocol = ' line' )
212
+ ```
213
+
214
+ ** influxdb-client-python**
215
+
216
+ ``` python
217
+ import pandas as pd
218
+
219
+ from influxdb_client import InfluxDBClient
220
+ from influxdb_client.client.write_api import SYNCHRONOUS
221
+
222
+ with InfluxDBClient(url = ' http://localhost:8086' , token = ' my-token' , org = ' my-org' ) as client:
223
+ write_api = client.write_api(write_options = SYNCHRONOUS )
224
+
225
+ df = pd.DataFrame(data = list (range (30 )),
226
+ index = pd.date_range(start = ' 2014-11-16' , periods = 30 , freq = ' H' ),
227
+ columns = [' 0' ])
228
+
229
+ write_api.write(bucket = ' my-bucket' , record = df, data_frame_measurement_name = ' demo' )
230
+
231
+ ```
232
+
194
233
## Querying
195
234
196
235
** influxdb-python**
0 commit comments