From 576a881bc79bdce7a2a31bceeea65aae3dd605fd Mon Sep 17 00:00:00 2001 From: SatoshiNewton <34567826+SatoshiNewton@users.noreply.github.com> Date: Tue, 9 Jan 2018 15:22:34 +0800 Subject: [PATCH 1/2] Fix the compatibility to pandas DataFrame Originally, the setting is use the list to confirm the precision issue, ['n', 'u', 'ms', 's', 'm', 'h', 'N', None]. However, i change the list to another form, ['n', 'u', 'ms', 's', 'm', 'h', 'N', 'U', 'L', 'S', 'M', 'H', None], because the pandas have some different in mine work. Pandas version: 0.22.0 OS: OS X. --- influxdb/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/influxdb/client.py b/influxdb/client.py index 01559cfc..14cd99b0 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -492,7 +492,7 @@ def _write_points(self, retention_policy, tags, protocol='json'): - if time_precision not in ['n', 'u', 'ms', 's', 'm', 'h', None]: + if time_precision not in ['n', 'u', 'ms', 's', 'm', 'h', 'N', 'U', 'L', 'S', 'M', 'H', None]: raise ValueError( "Invalid time precision is given. " "(use 'n', 'u', 'ms', 's', 'm' or 'h')") From a5b257445170fb0f63c1c3a3b98ba87ab39b6b64 Mon Sep 17 00:00:00 2001 From: SatoshiNewton <34567826+SatoshiNewton@users.noreply.github.com> Date: Tue, 9 Jan 2018 15:45:52 +0800 Subject: [PATCH 2/2] Fix the issue#497 for easy to use https://github.com/influxdata/influxdb-python/issues/497 --- influxdb/_dataframe_client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/influxdb/_dataframe_client.py b/influxdb/_dataframe_client.py index 86b582af..3e455fca 100644 --- a/influxdb/_dataframe_client.py +++ b/influxdb/_dataframe_client.py @@ -233,8 +233,10 @@ def _convert_dataframe_to_json(dataframe, tags = tags if tags is not None else {} # Assume field columns are all columns not included in tag columns if not field_columns: - field_columns = list( - set(dataframe.columns).difference(set(tag_columns))) + #field_columns = list( + # set(dataframe.columns).difference(set(tag_columns))) + field_columns_buf = list(set(dataframe.columns).difference(set(tag_columns))) + field_columns = [str(field_column) for field_column in field_columns_buf] dataframe.index = dataframe.index.to_datetime() if dataframe.index.tzinfo is None: