python-influxdb/python-influxdb-new-pandas.patch
Dirk Mueller 7b7236187a Accepting request 1128636 from home:bnavigator:branches:devel:languages:python
- Update python-influxdb-new-pandas.patch in order to avoid
  FutureWarning: does not work with pandas < 2.1
- Make pure python a noarch package
- PEP 517
- Upstream is archived, but still required by
  openSUSE-release-tools gh#openSUSE/openSUSE-release-tools#3034

OBS-URL: https://build.opensuse.org/request/show/1128636
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-influxdb?expand=0&rev=36
2023-11-25 22:45:13 +00:00

107 lines
4.8 KiB
Diff

Index: influxdb-5.3.1/influxdb/tests/dataframe_client_test.py
===================================================================
--- influxdb-5.3.1.orig/influxdb/tests/dataframe_client_test.py
+++ influxdb-5.3.1/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.1/influxdb/tests/influxdb08/dataframe_client_test.py
===================================================================
--- influxdb-5.3.1.orig/influxdb/tests/influxdb08/dataframe_client_test.py
+++ influxdb-5.3.1/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.1/influxdb/tests/server_tests/client_test_with_server.py
===================================================================
--- influxdb-5.3.1.orig/influxdb/tests/server_tests/client_test_with_server.py
+++ influxdb-5.3.1/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.1/influxdb/_dataframe_client.py
===================================================================
--- influxdb-5.3.1.orig/influxdb/_dataframe_client.py
+++ influxdb-5.3.1/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: