From 1915a3b4d60903cd90e4a4d869c58e9faa053ab5 Mon Sep 17 00:00:00 2001 From: pho Date: Thu, 18 May 2017 18:10:18 +0200 Subject: [PATCH] [FIX] : compatibility with new version of pandas pd.tseries.period.PeriodIndex has been moved to pd.PeriodIndex since at least pandas 0.18.1 pd.tseries.period.DatetimeIndex has been moved to pd.DatetimeIndex since at least pandas 0.18.1 --- influxdb/_dataframe_client.py | 10 +++++----- influxdb/influxdb08/dataframe_client.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/influxdb/_dataframe_client.py b/influxdb/_dataframe_client.py index 7683aeef..df187513 100644 --- a/influxdb/_dataframe_client.py +++ b/influxdb/_dataframe_client.py @@ -177,8 +177,8 @@ def _convert_dataframe_to_json(self, if not isinstance(dataframe, pd.DataFrame): raise TypeError('Must be DataFrame, but type was: {0}.' .format(type(dataframe))) - if not (isinstance(dataframe.index, pd.tseries.period.PeriodIndex) or - isinstance(dataframe.index, pd.tseries.index.DatetimeIndex)): + if not (isinstance(dataframe.index, pd.PeriodIndex) or + isinstance(dataframe.index, pd.DatetimeIndex)): raise TypeError('Must be DataFrame with DatetimeIndex or \ PeriodIndex.') @@ -234,8 +234,8 @@ def _convert_dataframe_to_lines(self, if not isinstance(dataframe, pd.DataFrame): raise TypeError('Must be DataFrame, but type was: {0}.' .format(type(dataframe))) - if not (isinstance(dataframe.index, pd.tseries.period.PeriodIndex) or - isinstance(dataframe.index, pd.tseries.index.DatetimeIndex)): + if not (isinstance(dataframe.index, pd.PeriodIndex) or + isinstance(dataframe.index, pd.DatetimeIndex)): raise TypeError('Must be DataFrame with DatetimeIndex or \ PeriodIndex.') @@ -279,7 +279,7 @@ def _convert_dataframe_to_lines(self, }.get(time_precision, 1) # Make array of timestamp ints - if isinstance(dataframe.index, pd.tseries.period.PeriodIndex): + if isinstance(dataframe.index, pd.PeriodIndex): time = ((dataframe.index.to_timestamp().values.astype(int) / precision_factor).astype(int).astype(str)) else: diff --git a/influxdb/influxdb08/dataframe_client.py b/influxdb/influxdb08/dataframe_client.py index ba302af8..59b033ab 100644 --- a/influxdb/influxdb08/dataframe_client.py +++ b/influxdb/influxdb08/dataframe_client.py @@ -128,12 +128,12 @@ def _convert_dataframe_to_json(self, dataframe, name, time_precision='s'): if not isinstance(dataframe, pd.DataFrame): raise TypeError('Must be DataFrame, but type was: {0}.' .format(type(dataframe))) - if not (isinstance(dataframe.index, pd.tseries.period.PeriodIndex) or - isinstance(dataframe.index, pd.tseries.index.DatetimeIndex)): + if not (isinstance(dataframe.index, pd.PeriodIndex) or + isinstance(dataframe.index, pd.DatetimeIndex)): raise TypeError('Must be DataFrame with DatetimeIndex or \ PeriodIndex.') - if isinstance(dataframe.index, pd.tseries.period.PeriodIndex): + if isinstance(dataframe.index, pd.PeriodIndex): dataframe.index = dataframe.index.to_timestamp() else: dataframe.index = pd.to_datetime(dataframe.index) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy