python-influxdb/python-influxdb-new-pandas.patch

107 lines
4.8 KiB
Diff
Raw Permalink Normal View History

Index: influxdb-5.3.2/influxdb/tests/dataframe_client_test.py
===================================================================
--- influxdb-5.3.2.orig/influxdb/tests/dataframe_client_test.py
+++ influxdb-5.3.2/influxdb/tests/dataframe_client_test.py
@@ -19,7 +19,10 @@ from .client_test import _mocked_session
if not using_pypy:
import pandas as pd
- from pandas.util.testing import assert_frame_equal
+ try:
+ from pandas.testing import assert_frame_equal
+ except ImportError:
+ from pandas.util.testing import assert_frame_equal
from influxdb import DataFrameClient
import numpy as np
@@ -947,7 +950,7 @@ class TestDataFrameClient(unittest.TestC
index=pd.to_datetime([
"2015-01-29 21:55:43.702900257+0000",
"2015-01-29 21:55:43.702900257+0000",
- "2015-06-11 20:46:02+0000"]))
+ "2015-06-11 20:46:02+0000"], format='ISO8601'))
if pd1.index.tzinfo is None:
pd1.index = pd1.index.tz_localize('UTC')
pd2 = pd.DataFrame(
@@ -1008,7 +1011,7 @@ class TestDataFrameClient(unittest.TestC
index=pd.to_datetime([
"2015-01-29 21:55:43.702900257+0000",
"2015-01-29 21:55:43.702900257+0000",
- "2015-06-11 20:46:02+0000"]))
+ "2015-06-11 20:46:02+0000"], format='ISO8601'))
if pd1.index.tzinfo is None:
pd1.index = pd1.index.tz_localize('UTC')
@@ -1019,7 +1022,7 @@ class TestDataFrameClient(unittest.TestC
index=pd.to_datetime([
"2015-01-29 21:55:43.702900257+0000",
"2015-01-29 21:55:43.702900257+0000",
- "2015-06-11 20:46:02+0000"]))
+ "2015-06-11 20:46:02+0000"], format='ISO8601'))
if pd1_dropna.index.tzinfo is None:
pd1_dropna.index = pd1_dropna.index.tz_localize('UTC')
Index: influxdb-5.3.2/influxdb/tests/influxdb08/dataframe_client_test.py
===================================================================
--- influxdb-5.3.2.orig/influxdb/tests/influxdb08/dataframe_client_test.py
+++ influxdb-5.3.2/influxdb/tests/influxdb08/dataframe_client_test.py
@@ -16,7 +16,10 @@ from .client_test import _mocked_session
if not using_pypy:
import pandas as pd
- from pandas.util.testing import assert_frame_equal
+ try:
+ from pandas.testing import assert_frame_equal
+ except ImportError:
+ from pandas.util.testing import assert_frame_equal
from influxdb.influxdb08 import DataFrameClient
Index: influxdb-5.3.2/influxdb/tests/server_tests/client_test_with_server.py
===================================================================
--- influxdb-5.3.2.orig/influxdb/tests/server_tests/client_test_with_server.py
+++ influxdb-5.3.2/influxdb/tests/server_tests/client_test_with_server.py
@@ -34,7 +34,10 @@ warnings.simplefilter('error', FutureWar
if not using_pypy:
import pandas as pd
- from pandas.util.testing import assert_frame_equal
+ try:
+ from pandas.testing import assert_frame_equal
+ except ImportError:
+ from pandas.util.testing import assert_frame_equal
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
Index: influxdb-5.3.2/influxdb/_dataframe_client.py
===================================================================
--- influxdb-5.3.2.orig/influxdb/_dataframe_client.py
+++ influxdb-5.3.2/influxdb/_dataframe_client.py
@@ -219,7 +219,7 @@ class DataFrameClient(InfluxDBClient):
else:
key = (name, tuple(sorted(tags.items())))
df = pd.DataFrame(data)
- df.time = pd.to_datetime(df.time)
+ df.time = pd.to_datetime(df.time, format='mixed')
if data_frame_index:
df.set_index(data_frame_index, inplace=True)
@@ -449,7 +449,7 @@ class DataFrameClient(InfluxDBClient):
include=['floating']).columns)
nonfloat_columns = dframe.columns[~dframe.columns.isin(
float_columns)]
- dframe[float_columns] = dframe[float_columns].applymap(repr)
+ dframe[float_columns] = dframe[float_columns].map(repr)
dframe[nonfloat_columns] = (dframe[nonfloat_columns].astype(str))
elif isinstance(numeric_precision, int):
# If precision is specified, round to appropriate precision
@@ -462,7 +462,7 @@ class DataFrameClient(InfluxDBClient):
# If desired precision is > 10 decimal places, need to use repr
if numeric_precision > 10:
- dframe[float_columns] = (dframe[float_columns].applymap(repr))
+ dframe[float_columns] = (dframe[float_columns].map(repr))
dframe[nonfloat_columns] = (dframe[nonfloat_columns]
.astype(str))
else: