8000 MAINT: avoid warning for Pandas >= 2.0 · larray-project/larray@92dfa86 · GitHub
[go: up one dir, main page]

Skip to content

Commit 92dfa86

Browse files
committed
MAINT: avoid warning for Pandas >= 2.0
some stricter (it only ever infers once) version of infer_datetime_format is now the default I choose not to bump pandas requirements to 2.0 because as far as I can tell, this only changes performance for metadata (little used feature) on Pandas < 2
1 parent e095876 commit 92dfa86

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

larray/core/metadata.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ def from_array(cls, array) -> 'Metadata':
6666
from pandas import to_numeric, to_datetime
6767

6868
def _convert_value(value):
69+
# errors='ignore' => the value is unmodified if it does not parse
6970
value = to_numeric([value], errors='ignore')[0]
7071
if isinstance(value, str):
71-
value = to_datetime(value, errors='ignore', infer_datetime_format=True)
72+
# same here
73+
value = to_datetime(value, errors='ignore')
7274
return value
7375

7476
return Metadata({key: _convert_value(value) for key, value in zip(array.axes.labels[0], array.data)})

0 commit comments

Comments
 (0)
0