db-dtypes 1.4.2__tar.gz → 1.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {db_dtypes-1.4.2/db_dtypes.egg-info → db_dtypes-1.4.4}/PKG-INFO +23 -11
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/README.rst +2 -2
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/db_dtypes/__init__.py +28 -42
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/db_dtypes/core.py +2 -6
- db_dtypes-1.4.4/db_dtypes/pandas_backports.py +74 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/db_dtypes/version.py +1 -1
- {db_dtypes-1.4.2 → db_dtypes-1.4.4/db_dtypes.egg-info}/PKG-INFO +23 -11
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/db_dtypes.egg-info/SOURCES.txt +1 -3
- db_dtypes-1.4.4/db_dtypes.egg-info/requires.txt +9 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/setup.cfg +0 -3
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/setup.py +7 -7
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/compliance/date/test_date_compliance.py +61 -2
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/compliance/json/test_json_compliance.py +72 -1
- db_dtypes-1.4.4/tests/compliance/time/test_time_compliance.py +165 -0
- db_dtypes-1.4.4/tests/unit/test__init__.py +85 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/unit/test_dtypes.py +18 -23
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/unit/test_json.py +2 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/unit/test_pandas_backports.py +16 -0
- db_dtypes-1.4.2/db_dtypes/pandas_backports.py +0 -160
- db_dtypes-1.4.2/db_dtypes.egg-info/requires.txt +0 -4
- db_dtypes-1.4.2/tests/compliance/date/test_date_compliance_1_5.py +0 -31
- db_dtypes-1.4.2/tests/compliance/time/test_time_compliance.py +0 -107
- db_dtypes-1.4.2/tests/compliance/time/test_time_compliance_1_5.py +0 -31
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/AUTHORS +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/LICENSE +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/MANIFEST.in +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/db_dtypes/_versions_helpers.py +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/db_dtypes/json.py +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/db_dtypes.egg-info/dependency_links.txt +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/db_dtypes.egg-info/top_level.txt +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/compliance/conftest.py +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/compliance/date/conftest.py +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/compliance/json/conftest.py +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/compliance/time/conftest.py +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/unit/test_arrow.py +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/unit/test_date.py +0 -0
- {db_dtypes-1.4.2 → db_dtypes-1.4.4}/tests/unit/test_time.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: db-dtypes
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.4
|
|
4
4
|
Summary: Pandas Data Types for SQL systems (BigQuery, Spanner)
|
|
5
5
|
Home-page: https://github.com/googleapis/python-db-dtypes-pandas
|
|
6
6
|
Author: The db-dtypes Authors
|
|
@@ -12,22 +12,34 @@ Classifier: Intended Audience :: Developers
|
|
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
20
|
Classifier: Operating System :: OS Independent
|
|
22
21
|
Classifier: Topic :: Database :: Front-Ends
|
|
23
|
-
Requires-Python: >=3.
|
|
22
|
+
Requires-Python: >=3.9
|
|
24
23
|
Description-Content-Type: text/x-rst
|
|
25
24
|
License-File: LICENSE
|
|
26
25
|
License-File: AUTHORS
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
26
|
+
Requires-Dist: numpy<=2.2.6,>=1.24.0; python_version == "3.10"
|
|
27
|
+
Requires-Dist: numpy>=1.24.0; python_version != "3.10"
|
|
28
|
+
Requires-Dist: packaging>=24.2.0
|
|
29
|
+
Requires-Dist: pandas>=1.5.3
|
|
30
|
+
Requires-Dist: pyarrow>=13.0.0
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: description-content-type
|
|
36
|
+
Dynamic: home-page
|
|
37
|
+
Dynamic: keywords
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: platform
|
|
40
|
+
Dynamic: requires-dist
|
|
41
|
+
Dynamic: requires-python
|
|
42
|
+
Dynamic: summary
|
|
31
43
|
|
|
32
44
|
Pandas Data Types for SQL systems (BigQuery, Spanner)
|
|
33
45
|
=====================================================
|
|
@@ -65,11 +77,11 @@ dependencies.
|
|
|
65
77
|
|
|
66
78
|
Supported Python Versions
|
|
67
79
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
68
|
-
Python >= 3.
|
|
80
|
+
Python >= 3.9
|
|
69
81
|
|
|
70
82
|
Unsupported Python Versions
|
|
71
83
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
72
|
-
Python <= 3.
|
|
84
|
+
Python <= 3.8.
|
|
73
85
|
|
|
74
86
|
|
|
75
87
|
Mac/Linux
|
|
@@ -21,7 +21,6 @@ from typing import Optional, Union
|
|
|
21
21
|
import warnings
|
|
22
22
|
|
|
23
23
|
import numpy
|
|
24
|
-
import packaging.version
|
|
25
24
|
import pandas
|
|
26
25
|
import pandas.api.extensions
|
|
27
26
|
from pandas.errors import OutOfBoundsDatetime
|
|
@@ -29,7 +28,7 @@ import pyarrow
|
|
|
29
28
|
import pyarrow.compute
|
|
30
29
|
|
|
31
30
|
from db_dtypes import core
|
|
32
|
-
from db_dtypes.
|
|
31
|
+
from db_dtypes.json import JSONArray, JSONDtype, JSONArrowType # noqa: F401
|
|
33
32
|
|
|
34
33
|
from . import _versions_helpers
|
|
35
34
|
|
|
@@ -47,15 +46,6 @@ _NP_DTYPE = "datetime64[ns]"
|
|
|
47
46
|
_NP_BOX_DTYPE = "datetime64[us]"
|
|
48
47
|
|
|
49
48
|
|
|
50
|
-
# To use JSONArray and JSONDtype, you'll need Pandas 1.5.0 or later. With the removal
|
|
51
|
-
# of Python 3.7 compatibility, the minimum Pandas version will be updated to 1.5.0.
|
|
52
|
-
if packaging.version.Version(pandas.__version__) >= packaging.version.Version("1.5.0"):
|
|
53
|
-
from db_dtypes.json import JSONArray, JSONArrowType, JSONDtype
|
|
54
|
-
else:
|
|
55
|
-
JSONArray = None
|
|
56
|
-
JSONDtype = None
|
|
57
|
-
|
|
58
|
-
|
|
59
49
|
@pandas.api.extensions.register_extension_dtype
|
|
60
50
|
class TimeDtype(core.BaseDatetimeDtype):
|
|
61
51
|
"""
|
|
@@ -347,34 +337,30 @@ class DateArray(core.BaseDatetimeArray):
|
|
|
347
337
|
return super().__sub__(other)
|
|
348
338
|
|
|
349
339
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
"JSONArrowType",
|
|
378
|
-
"TimeArray",
|
|
379
|
-
"TimeDtype",
|
|
380
|
-
]
|
|
340
|
+
def _check_python_version():
|
|
341
|
+
"""Checks the runtime Python version and issues a warning if needed."""
|
|
342
|
+
sys_major, sys_minor, sys_micro = _versions_helpers.extract_runtime_version()
|
|
343
|
+
if sys_major == 3 and sys_minor in (7, 8):
|
|
344
|
+
warnings.warn(
|
|
345
|
+
"The python-bigquery library as well as the python-db-dtypes-pandas library no "
|
|
346
|
+
"longer supports Python 3.7 and Python 3.8. "
|
|
347
|
+
f"Your Python version is {sys_major}.{sys_minor}.{sys_micro}. We "
|
|
348
|
+
"recommend that you update soon to ensure ongoing support. For "
|
|
349
|
+
"more details, see: [Google Cloud Client Libraries Supported Python Versions policy](https://cloud.google.com/python/docs/supported-python-versions)",
|
|
350
|
+
FutureWarning,
|
|
351
|
+
stacklevel=2, # Point warning to the caller of __init__
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
_check_python_version()
|
|
356
|
+
|
|
357
|
+
__all__ = [
|
|
358
|
+
"__version__",
|
|
359
|
+
"DateArray",
|
|
360
|
+
"DateDtype",
|
|
361
|
+
"TimeArray",
|
|
362
|
+
"TimeDtype",
|
|
363
|
+
"JSONDtype",
|
|
364
|
+
"JSONArray",
|
|
365
|
+
"JSONArrowType",
|
|
366
|
+
]
|
|
@@ -18,6 +18,7 @@ import numpy
|
|
|
18
18
|
import pandas
|
|
19
19
|
import pandas.api.extensions
|
|
20
20
|
from pandas.api.types import is_dtype_equal, is_list_like, is_scalar, pandas_dtype
|
|
21
|
+
from pandas.core.arrays import _mixins
|
|
21
22
|
|
|
22
23
|
from db_dtypes import pandas_backports
|
|
23
24
|
|
|
@@ -42,9 +43,7 @@ class BaseDatetimeDtype(pandas.api.extensions.ExtensionDtype):
|
|
|
42
43
|
return cls()
|
|
43
44
|
|
|
44
45
|
|
|
45
|
-
class BaseDatetimeArray(
|
|
46
|
-
pandas_backports.OpsMixin, pandas_backports.NDArrayBackedExtensionArray
|
|
47
|
-
):
|
|
46
|
+
class BaseDatetimeArray(pandas_backports.OpsMixin, _mixins.NDArrayBackedExtensionArray):
|
|
48
47
|
# scalar used to denote NA value inside our self._ndarray, e.g. -1 for
|
|
49
48
|
# Categorical, iNaT for Period. Outside of object dtype, self.isna() should
|
|
50
49
|
# be exactly locations in self._ndarray with _internal_fill_value. See:
|
|
@@ -186,9 +185,6 @@ class BaseDatetimeArray(
|
|
|
186
185
|
keepdims: bool = False,
|
|
187
186
|
skipna: bool = True,
|
|
188
187
|
):
|
|
189
|
-
if not hasattr(pandas_backports, "numpy_validate_median"):
|
|
190
|
-
raise NotImplementedError("Need pandas 1.3 or later to calculate median.")
|
|
191
|
-
|
|
192
188
|
pandas_backports.numpy_validate_median(
|
|
193
189
|
(),
|
|
194
190
|
{"out": out, "overwrite_input": overwrite_input, "keepdims": keepdims},
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Copyright 2021 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
|
+
Utilities to support older pandas versions.
|
|
17
|
+
|
|
18
|
+
These backported versions are simpler and, in some cases, less featureful than
|
|
19
|
+
the versions in the later versions of pandas.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
import packaging.version
|
|
23
|
+
import pandas
|
|
24
|
+
import pandas.compat.numpy.function
|
|
25
|
+
|
|
26
|
+
pandas_release = packaging.version.parse(pandas.__version__).release
|
|
27
|
+
|
|
28
|
+
# # Create aliases for private methods in case they move in a future version.
|
|
29
|
+
nanall = pandas.core.nanops.nanall
|
|
30
|
+
nanany = pandas.core.nanops.nanany
|
|
31
|
+
nanmax = pandas.core.nanops.nanmax
|
|
32
|
+
nanmin = pandas.core.nanops.nanmin
|
|
33
|
+
numpy_validate_all = pandas.compat.numpy.function.validate_all
|
|
34
|
+
numpy_validate_any = pandas.compat.numpy.function.validate_any
|
|
35
|
+
numpy_validate_max = pandas.compat.numpy.function.validate_max
|
|
36
|
+
numpy_validate_min = pandas.compat.numpy.function.validate_min
|
|
37
|
+
|
|
38
|
+
nanmedian = pandas.core.nanops.nanmedian
|
|
39
|
+
numpy_validate_median = pandas.compat.numpy.function.validate_median
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def import_default(module_name, force=False, default=None):
|
|
43
|
+
"""
|
|
44
|
+
Provide an implementation for a class or function when it can't be imported
|
|
45
|
+
|
|
46
|
+
or when force is True.
|
|
47
|
+
|
|
48
|
+
This is used to replicate Pandas APIs that are missing or insufficient
|
|
49
|
+
(thus the force option) in early pandas versions.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
if default is None:
|
|
53
|
+
return lambda func_or_class: import_default(module_name, force, func_or_class)
|
|
54
|
+
|
|
55
|
+
if force:
|
|
56
|
+
return default
|
|
57
|
+
|
|
58
|
+
name = default.__name__
|
|
59
|
+
try:
|
|
60
|
+
module = __import__(module_name, {}, {}, [name])
|
|
61
|
+
except ModuleNotFoundError:
|
|
62
|
+
return default
|
|
63
|
+
|
|
64
|
+
return getattr(module, name, default)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# pandas.core.arraylike.OpsMixin is private, but the related public API
|
|
68
|
+
# "ExtensionScalarOpsMixin" is not sufficient for adding dates to times.
|
|
69
|
+
# It results in unsupported operand type(s) for +: 'datetime.time' and
|
|
70
|
+
# 'datetime.date'
|
|
71
|
+
@import_default("pandas.core.arraylike")
|
|
72
|
+
class OpsMixin:
|
|
73
|
+
def _cmp_method(self, other, op): # pragma: NO COVER
|
|
74
|
+
return NotImplemented
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: db-dtypes
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.4
|
|
4
4
|
Summary: Pandas Data Types for SQL systems (BigQuery, Spanner)
|
|
5
5
|
Home-page: https://github.com/googleapis/python-db-dtypes-pandas
|
|
6
6
|
Author: The db-dtypes Authors
|
|
@@ -12,22 +12,34 @@ Classifier: Intended Audience :: Developers
|
|
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
20
|
Classifier: Operating System :: OS Independent
|
|
22
21
|
Classifier: Topic :: Database :: Front-Ends
|
|
23
|
-
Requires-Python: >=3.
|
|
22
|
+
Requires-Python: >=3.9
|
|
24
23
|
Description-Content-Type: text/x-rst
|
|
25
24
|
License-File: LICENSE
|
|
26
25
|
License-File: AUTHORS
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
26
|
+
Requires-Dist: numpy<=2.2.6,>=1.24.0; python_version == "3.10"
|
|
27
|
+
Requires-Dist: numpy>=1.24.0; python_version != "3.10"
|
|
28
|
+
Requires-Dist: packaging>=24.2.0
|
|
29
|
+
Requires-Dist: pandas>=1.5.3
|
|
30
|
+
Requires-Dist: pyarrow>=13.0.0
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: description-content-type
|
|
36
|
+
Dynamic: home-page
|
|
37
|
+
Dynamic: keywords
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: platform
|
|
40
|
+
Dynamic: requires-dist
|
|
41
|
+
Dynamic: requires-python
|
|
42
|
+
Dynamic: summary
|
|
31
43
|
|
|
32
44
|
Pandas Data Types for SQL systems (BigQuery, Spanner)
|
|
33
45
|
=====================================================
|
|
@@ -65,11 +77,11 @@ dependencies.
|
|
|
65
77
|
|
|
66
78
|
Supported Python Versions
|
|
67
79
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
68
|
-
Python >= 3.
|
|
80
|
+
Python >= 3.9
|
|
69
81
|
|
|
70
82
|
Unsupported Python Versions
|
|
71
83
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
72
|
-
Python <= 3.
|
|
84
|
+
Python <= 3.8.
|
|
73
85
|
|
|
74
86
|
|
|
75
87
|
Mac/Linux
|
|
@@ -2,7 +2,6 @@ AUTHORS
|
|
|
2
2
|
LICENSE
|
|
3
3
|
MANIFEST.in
|
|
4
4
|
README.rst
|
|
5
|
-
setup.cfg
|
|
6
5
|
setup.py
|
|
7
6
|
db_dtypes/__init__.py
|
|
8
7
|
db_dtypes/_versions_helpers.py
|
|
@@ -18,12 +17,11 @@ db_dtypes.egg-info/top_level.txt
|
|
|
18
17
|
tests/compliance/conftest.py
|
|
19
18
|
tests/compliance/date/conftest.py
|
|
20
19
|
tests/compliance/date/test_date_compliance.py
|
|
21
|
-
tests/compliance/date/test_date_compliance_1_5.py
|
|
22
20
|
tests/compliance/json/conftest.py
|
|
23
21
|
tests/compliance/json/test_json_compliance.py
|
|
24
22
|
tests/compliance/time/conftest.py
|
|
25
23
|
tests/compliance/time/test_time_compliance.py
|
|
26
|
-
tests/
|
|
24
|
+
tests/unit/test__init__.py
|
|
27
25
|
tests/unit/test_arrow.py
|
|
28
26
|
tests/unit/test_date.py
|
|
29
27
|
tests/unit/test_dtypes.py
|
|
@@ -30,10 +30,11 @@ description = "Pandas Data Types for SQL systems (BigQuery, Spanner)"
|
|
|
30
30
|
release_status = "Development Status :: 5 - Production/Stable"
|
|
31
31
|
|
|
32
32
|
dependencies = [
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
33
|
+
"numpy >= 1.24.0, <= 2.2.6 ; python_version == '3.10'",
|
|
34
|
+
"numpy >= 1.24.0 ; python_version != '3.10'",
|
|
35
|
+
"packaging >= 24.2.0",
|
|
36
|
+
"pandas >= 1.5.3",
|
|
37
|
+
"pyarrow >= 13.0.0",
|
|
37
38
|
]
|
|
38
39
|
|
|
39
40
|
package_root = os.path.abspath(os.path.dirname(__file__))
|
|
@@ -63,17 +64,16 @@ setup(
|
|
|
63
64
|
"License :: OSI Approved :: Apache Software License",
|
|
64
65
|
"Programming Language :: Python",
|
|
65
66
|
"Programming Language :: Python :: 3",
|
|
66
|
-
"Programming Language :: Python :: 3.7",
|
|
67
|
-
"Programming Language :: Python :: 3.8",
|
|
68
67
|
"Programming Language :: Python :: 3.9",
|
|
69
68
|
"Programming Language :: Python :: 3.10",
|
|
70
69
|
"Programming Language :: Python :: 3.11",
|
|
71
70
|
"Programming Language :: Python :: 3.12",
|
|
71
|
+
"Programming Language :: Python :: 3.13",
|
|
72
72
|
"Operating System :: OS Independent",
|
|
73
73
|
"Topic :: Database :: Front-Ends",
|
|
74
74
|
],
|
|
75
75
|
platforms="Posix; MacOS X; Windows",
|
|
76
76
|
install_requires=dependencies,
|
|
77
|
-
python_requires=">=3.
|
|
77
|
+
python_requires=">=3.9",
|
|
78
78
|
tests_require=["pytest"],
|
|
79
79
|
)
|
|
@@ -51,7 +51,15 @@ class TestDtype(base.BaseDtypeTests):
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
class TestGetitem(base.BaseGetitemTests):
|
|
54
|
-
|
|
54
|
+
def test_take_pandas_style_negative_raises(self, data, na_value):
|
|
55
|
+
# This test was failing compliance checks because it attempted to match
|
|
56
|
+
# a pytest regex match using an empty string (""), which pytest version
|
|
57
|
+
# 8.4.0 stopped allowing.
|
|
58
|
+
# The test has been updated in pandas main so that it will
|
|
59
|
+
# no longer fail, but the fix is not expected to be released until
|
|
60
|
+
# at least pandas version 3.0 (current version is 2.3).
|
|
61
|
+
with pytest.raises(ValueError):
|
|
62
|
+
data.take([0, -2], fill_value=na_value, allow_fill=True)
|
|
55
63
|
|
|
56
64
|
|
|
57
65
|
class TestGroupby(base.BaseGroupbyTests):
|
|
@@ -63,7 +71,26 @@ class TestIndex(base.BaseIndexTests):
|
|
|
63
71
|
|
|
64
72
|
|
|
65
73
|
class TestInterface(base.BaseInterfaceTests):
|
|
66
|
-
|
|
74
|
+
def test_array_interface_copy(self, data):
|
|
75
|
+
# This test was failing compliance checks due to changes in how
|
|
76
|
+
# numpy handles processing when np.array(obj, copy=False).
|
|
77
|
+
# Until pandas changes the existing tests, this compliance test
|
|
78
|
+
# will continue to fail.
|
|
79
|
+
import numpy as np
|
|
80
|
+
from pandas.compat.numpy import np_version_gt2
|
|
81
|
+
|
|
82
|
+
result_copy1 = np.array(data, copy=True)
|
|
83
|
+
result_copy2 = np.array(data, copy=True)
|
|
84
|
+
assert not np.may_share_memory(result_copy1, result_copy2)
|
|
85
|
+
|
|
86
|
+
if not np_version_gt2:
|
|
87
|
+
# copy=False semantics are only supported in NumPy>=2.
|
|
88
|
+
return
|
|
89
|
+
|
|
90
|
+
with pytest.raises(ValueError):
|
|
91
|
+
result_nocopy1 = np.array(data, copy=False)
|
|
92
|
+
result_nocopy2 = np.array(data, copy=False)
|
|
93
|
+
assert np.may_share_memory(result_nocopy1, result_nocopy2)
|
|
67
94
|
|
|
68
95
|
|
|
69
96
|
class TestMissing(base.BaseMissingTests):
|
|
@@ -102,6 +129,21 @@ class TestMethods(base.BaseMethodsTests):
|
|
|
102
129
|
further investigation. See issues 182, 183, 185."""
|
|
103
130
|
)
|
|
104
131
|
|
|
132
|
+
def test_argmax_argmin_no_skipna_notimplemented(self, data_missing_for_sorting):
|
|
133
|
+
# This test was failing compliance checks because it attempted to match
|
|
134
|
+
# a pytest regex match using an empty string (""), which pytest version
|
|
135
|
+
# 8.4.0 stopped allowing.
|
|
136
|
+
# The test has been updated in pandas main so that it will
|
|
137
|
+
# no longer fail, but the fix is not expected to be released until
|
|
138
|
+
# at least pandas version 3.0 (current version is 2.3)
|
|
139
|
+
data = data_missing_for_sorting
|
|
140
|
+
|
|
141
|
+
with pytest.raises(NotImplementedError):
|
|
142
|
+
data.argmin(skipna=False)
|
|
143
|
+
|
|
144
|
+
with pytest.raises(NotImplementedError):
|
|
145
|
+
data.argmax(skipna=False)
|
|
146
|
+
|
|
105
147
|
|
|
106
148
|
class TestParsing(base.BaseParsingTests):
|
|
107
149
|
pass
|
|
@@ -116,4 +158,21 @@ class TestReshaping(base.BaseReshapingTests):
|
|
|
116
158
|
|
|
117
159
|
|
|
118
160
|
class TestSetitem(base.BaseSetitemTests):
|
|
161
|
+
# This test was failing compliance checks because it attempted to match
|
|
162
|
+
# a pytest regex match using an empty string (""), which pytest version
|
|
163
|
+
# 8.4.0 stopped allowing.
|
|
164
|
+
# The test has been updated in pandas main so that it will
|
|
165
|
+
# no longer fail, but the fix is not expected to be released until
|
|
166
|
+
# at least pandas version 3.0 (current version is 2.3).
|
|
167
|
+
def test_setitem_invalid(self, data, invalid_scalar):
|
|
168
|
+
with pytest.raises((ValueError, TypeError)):
|
|
169
|
+
data[0] = invalid_scalar
|
|
170
|
+
|
|
171
|
+
with pytest.raises((ValueError, TypeError)):
|
|
172
|
+
data[:] = invalid_scalar
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
# NDArrayBacked2DTests suite added in https://github.com/pandas-dev/pandas/pull/44974
|
|
176
|
+
# v1.4.0rc0
|
|
177
|
+
class Test2DCompat(base.NDArrayBacked2DTests):
|
|
119
178
|
pass
|
|
@@ -107,6 +107,16 @@ class TestJSONArrayGetitem(base.BaseGetitemTests):
|
|
|
107
107
|
"""
|
|
108
108
|
super().test_getitem_scalar(data)
|
|
109
109
|
|
|
110
|
+
def test_take_pandas_style_negative_raises(self, data, na_value):
|
|
111
|
+
# This test was failing compliance checks because it attempted to match
|
|
112
|
+
# a pytest regex match using an empty string (""), which pytest version
|
|
113
|
+
# 8.4.0 stopped allowing.
|
|
114
|
+
# The test has been updated in pandas main so that it will
|
|
115
|
+
# no longer fail, but the fix is not expected to be released until
|
|
116
|
+
# at least pandas version 3.0 (current version is 2.3).
|
|
117
|
+
with pytest.raises(ValueError):
|
|
118
|
+
data.take([0, -2], fill_value=na_value, allow_fill=True)
|
|
119
|
+
|
|
110
120
|
|
|
111
121
|
class TestJSONArrayIndex(base.BaseIndexTests):
|
|
112
122
|
pass
|
|
@@ -133,6 +143,26 @@ class TestJSONArrayInterface(base.BaseInterfaceTests):
|
|
|
133
143
|
def test_view(self, data):
|
|
134
144
|
super().test_view(data)
|
|
135
145
|
|
|
146
|
+
def test_array_interface_copy(self, data):
|
|
147
|
+
# This test was failing compliance checks due to changes in how
|
|
148
|
+
# numpy handles processing when np.array(obj, copy=False).
|
|
149
|
+
# Until pandas changes the existing tests, this compliance test
|
|
150
|
+
# will continue to fail.
|
|
151
|
+
import numpy as np
|
|
152
|
+
from pandas.compat.numpy import np_version_gt2
|
|
153
|
+
|
|
154
|
+
result_copy1 = np.array(data, copy=True)
|
|
155
|
+
result_copy2 = np.array(data, copy=True)
|
|
156
|
+
assert not np.may_share_memory(result_copy1, result_copy2)
|
|
157
|
+
|
|
158
|
+
if not np_version_gt2:
|
|
159
|
+
# copy=False semantics are only supported in NumPy>=2.
|
|
160
|
+
return
|
|
161
|
+
|
|
162
|
+
result_nocopy1 = np.array(data, copy=False)
|
|
163
|
+
result_nocopy2 = np.array(data, copy=False)
|
|
164
|
+
assert not np.may_share_memory(result_nocopy1, result_nocopy2)
|
|
165
|
+
|
|
136
166
|
|
|
137
167
|
class TestJSONArrayParsing(base.BaseParsingTests):
|
|
138
168
|
@pytest.mark.xfail(reason="data type 'json' not understood")
|
|
@@ -190,6 +220,21 @@ class TestJSONArrayMethods(base.BaseMethodsTests):
|
|
|
190
220
|
def test_sort_values_frame(self, data_for_sorting):
|
|
191
221
|
super().test_sort_values_frame(data_for_sorting)
|
|
192
222
|
|
|
223
|
+
def test_argmax_argmin_no_skipna_notimplemented(self, data_missing_for_sorting):
|
|
224
|
+
# This test was failing compliance checks because it attempted to match
|
|
225
|
+
# a pytest regex match using an empty string (""), which pytest version
|
|
226
|
+
# 8.4.0 stopped allowing.
|
|
227
|
+
# The test has been updated in pandas main so that it will
|
|
228
|
+
# no longer fail, but the fix is not expected to be released until
|
|
229
|
+
# at least pandas version 3.0 (current version is 2.3)
|
|
230
|
+
data = data_missing_for_sorting
|
|
231
|
+
|
|
232
|
+
with pytest.raises(NotImplementedError):
|
|
233
|
+
data.argmin(skipna=False)
|
|
234
|
+
|
|
235
|
+
with pytest.raises(NotImplementedError):
|
|
236
|
+
data.argmax(skipna=False)
|
|
237
|
+
|
|
193
238
|
|
|
194
239
|
class TestJSONArrayMissing(base.BaseMissingTests):
|
|
195
240
|
@pytest.mark.xfail(reason="Setting a dict as a scalar")
|
|
@@ -239,7 +284,20 @@ class TestJSONArrayPrinting(base.BasePrintingTests):
|
|
|
239
284
|
|
|
240
285
|
|
|
241
286
|
class TestJSONArrayReduce(base.BaseReduceTests):
|
|
242
|
-
|
|
287
|
+
@pytest.mark.filterwarnings("ignore::RuntimeWarning")
|
|
288
|
+
@pytest.mark.parametrize("skipna", [True, False])
|
|
289
|
+
def test_reduce_series_numeric(self, data, all_numeric_reductions, skipna):
|
|
290
|
+
op_name = all_numeric_reductions
|
|
291
|
+
ser = pd.Series(data)
|
|
292
|
+
|
|
293
|
+
if not self._supports_reduction(ser, op_name):
|
|
294
|
+
# Sum does not raise an Error (TypeError or otherwise)
|
|
295
|
+
if op_name != "sum":
|
|
296
|
+
with pytest.raises(TypeError):
|
|
297
|
+
getattr(ser, op_name)(skipna=skipna)
|
|
298
|
+
else:
|
|
299
|
+
# min/max with empty produce numpy warnings
|
|
300
|
+
self.check_reduce(ser, op_name, skipna)
|
|
243
301
|
|
|
244
302
|
|
|
245
303
|
class TestJSONArrayReshaping(base.BaseReshapingTests):
|
|
@@ -356,6 +414,19 @@ class TestJSONArraySetitem(base.BaseSetitemTests):
|
|
|
356
414
|
def test_setitem_preserves_views(self, data):
|
|
357
415
|
super().test_setitem_preserves_views(data)
|
|
358
416
|
|
|
417
|
+
def test_setitem_invalid(self, data, invalid_scalar):
|
|
418
|
+
# This test was failing compliance checks because it attempted to match
|
|
419
|
+
# a pytest regex match using an empty string (""), which pytest version
|
|
420
|
+
# 8.4.0 stopped allowing.
|
|
421
|
+
# The test has been updated in pandas main so that it will
|
|
422
|
+
# no longer fail, but the fix is not expected to be released until
|
|
423
|
+
# at least pandas version 3.0 (current version is 2.3)
|
|
424
|
+
with pytest.raises((ValueError, TypeError)):
|
|
425
|
+
data[0] = invalid_scalar
|
|
426
|
+
|
|
427
|
+
with pytest.raises((ValueError, TypeError)):
|
|
428
|
+
data[:] = invalid_scalar
|
|
429
|
+
|
|
359
430
|
|
|
360
431
|
class TestJSONArrayDim2Compat(base.Dim2CompatTests):
|
|
361
432
|
pass
|