""" routings for casting """
from datetime import datetime, timedelta
+import warnings
+import platform
+import re
+warn_nannat_platform = "Non-x86 system detected, float -> datetime/timedelta may not handle NaNs correctly - https://bugs.debian.org/877754" if not bool(re.match('i.?86|x86',platform.uname()[4])) else False
import numpy as np
f"'{dtype.name}[ns]' instead."
)
raise ValueError(msg)
+ if warn_nannat_platform and (is_datetime64_dtype(dtype) or is_timedelta64_dtype(dtype)) and np.issubdtype(arr.dtype, np.floating) and not np.isfinite(arr).all():
+ warnings.warn(warn_nannat_platform)
if copy or is_object_dtype(arr) or is_object_dtype(dtype):
# Explicit copy, or required since NumPy can't view from / to object.
value = iNaT
else:
value = np.array(value, copy=False)
+ if warn_nannat_platform and np.issubdtype(value.dtype, np.floating) and not np.isfinite(value).all():
+ warnings.warn(warn_nannat_platform)
# have a scalar array-like (e.g. NaT)
if value.ndim == 0:
from pandas import DatetimeIndex, Series, Timestamp
import pandas._testing as tm
+import platform
+import re
+is_nannat_working=bool(re.match('i.?86|x86',platform.uname()[4]))
@pytest.mark.parametrize(
tm.assert_numpy_array_equal(result, np.array([], dtype=np.int64))
+@pytest.mark.xfail(condition=not is_nannat_working,reason="https://bugs.debian.org/877754",strict=False)
@pytest.mark.parametrize("klass", [np.datetime64, np.timedelta64])
def test_datetime_likes_nan(klass):
dtype = klass.__name__ + "[ns]"
import pandas as pd
from pandas import DataFrame, DatetimeIndex, Series, Timestamp, date_range, isna
import pandas._testing as tm
+import platform
+import re
+is_nannat_working=bool(re.match('i.?86|x86|s390|ppc',platform.uname()[4]))
class TestDataFrameIndexingWhere:
result = a.where(do_not_replace, b)
tm.assert_frame_equal(result, expected)
+ @pytest.mark.xfail(condition=not is_nannat_working,reason="https://bugs.debian.org/877754",strict=False)#not found
def test_where_datetime(self):
# GH 3311
import pandas._testing as tm
import pandas.core.algorithms as algorithms
import pandas.core.nanops as nanops
+import platform
+import re
+is_nannat_working=bool(re.match('i.?86|x86|s390|ppc',platform.uname()[4]))
def assert_stat_op_calc(
expected = pd.Series(result, index=["A", "B"])
tm.assert_series_equal(result, expected)
+ @pytest.mark.xfail(condition=not is_nannat_working,reason="https://bugs.debian.org/877754",strict=False)
def test_sum_nanops_timedelta(self):
# prod isn't defined on timedeltas
idx = ["a", "b", "c"]
import pandas as pd
from pandas import DataFrame, DatetimeIndex, Index, Timestamp, date_range, offsets
import pandas._testing as tm
+import platform
+import re
+is_nannat_working=bool(re.match('i.?86|x86|s390|ppc',platform.uname()[4]))
randn = np.random.randn
idx2 = pd.date_range(end="2000", periods=periods, freq="S")
assert len(idx2) == periods
+ @pytest.mark.xfail(condition=not is_nannat_working,reason="https://bugs.debian.org/877754",strict=False)
def test_nat(self):
assert DatetimeIndex([np.nan])[0] is pd.NaT
)
import pandas._testing as tm
from pandas.core import nanops
+import platform
+import re
+is_nannat_working=bool(re.match('i.?86|x86|s390|ppc',platform.uname()[4]))
def get_objs():
expected = Series(expected2, dtype=object)
tm.assert_series_equal(result, expected)
+ @pytest.mark.xfail(condition=not is_nannat_working,reason="https://bugs.debian.org/877754",strict=False)
@pytest.mark.parametrize(
"dropna, expected1, expected2",
[
)
import pandas._testing as tm
from pandas.core.arrays import IntervalArray, period_array
-
+import platform
+import re
+is_nannat_working=bool(re.match('i.?86|x86|s390|ppc',platform.uname()[4]))
class TestSeriesConstructors:
@pytest.mark.parametrize(
tm.assert_series_equal(result, expected)
+ @pytest.mark.xfail(condition=not is_nannat_working,reason="https://bugs.debian.org/877754",strict=False)
@pytest.mark.parametrize("arg", ["2013-01-01 00:00:00", pd.NaT, np.nan, None])
def test_constructor_with_naive_string_and_datetimetz_dtype(self, arg):
# GH 17415: With naive string
series[2] = val
assert isna(series[2])
+ @pytest.mark.xfail(condition=not is_nannat_working,reason="https://bugs.debian.org/877754",strict=False)
def test_NaT_cast(self):
# GH10747
result = Series([np.nan]).astype("M8[ns]")
import pandas.core.algorithms as algos
from pandas.core.arrays import DatetimeArray
import pandas.core.common as com
+import platform
+import re
+is_nannat_working=bool(re.match('i.?86|x86|s390|ppc',platform.uname()[4]))
class TestFactorize:
expected = Series([2, 1, 1], index=[5.0, 10.3, np.nan])
tm.assert_series_equal(result, expected)
+ @pytest.mark.xfail(condition=not is_nannat_working,reason="https://bugs.debian.org/877754",strict=False)
def test_value_counts_normalized(self):
# GH12558
s = Series([1, 2, np.nan, np.nan, np.nan])