Skip to content

tests.compliance.date.test_date_compliance.TestMethods: test_diff[-2] failed #183

Closed
@flaky-bot

Description

@flaky-bot

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and
I will stop commenting.


commit: 4161b81
buildURL: Build Status, Sponge
status: failed

Test output
self = 
data = 
[datetime.date(1900, 1, 1), datetime.date(1902, 1, 2),
 datetime.date(1904, 1, 3), datetime.date(1906, 1, 3),
 datetime.date(1908, 1, 4)]
Length: 5, dtype: dbdate
periods = -2
@pytest.mark.parametrize("periods", [1, -2])
def test_diff(self, data, periods):
    data = data[:5]
    if is_bool_dtype(data.dtype):
        op = operator.xor
    else:
        op = operator.sub
    try:
        # does this array implement ops?
        op(data, data)
    except Exception:
        pytest.skip(f"{type(data)} does not support diff")
    s = pd.Series(data)
    result = s.diff(periods)
    expected = pd.Series(op(data, data.shift(periods)))
    self.assert_series_equal(result, expected)

    df = pd.DataFrame({"A": data, "B": [1.0] * 5})
  result = df.diff(periods)

.nox/compliance_prerelease/lib/python3.11/site-packages/pandas/tests/extension/base/methods.py:389:


.nox/compliance_prerelease/lib/python3.11/site-packages/pandas/core/frame.py:9471: in diff
new_data = self._mgr.diff(n=periods, axis=axis)
.nox/compliance_prerelease/lib/python3.11/site-packages/pandas/core/internals/managers.py:415: in diff
return self.apply("diff", n=n, axis=axis)
.nox/compliance_prerelease/lib/python3.11/site-packages/pandas/core/internals/managers.py:353: in apply
applied = getattr(b, f)(**kwargs)
.nox/compliance_prerelease/lib/python3.11/site-packages/pandas/core/internals/blocks.py:2042: in diff
return [self.make_block(values=new_values)]
.nox/compliance_prerelease/lib/python3.11/site-packages/pandas/core/internals/blocks.py:228: in make_block
return new_block(values, placement=placement, ndim=self.ndim, refs=refs)


values = array([[-126316800000000000, -126316800000000000, -126316800000000000,
'NaT', 'NaT']],
dtype='timedelta64[ns]')
placement = BlockPlacement(slice(0, 1, 1))

def new_block(
    values,
    placement: BlockPlacement,
    *,
    ndim: int,
    refs: BlockValuesRefs | None = None,
) -> Block:
    # caller is responsible for ensuring:
    # - values is NOT a PandasArray
    # - check_ndim/ensure_block_shape already checked
    # - maybe_coerce_values already called/unnecessary
    klass = get_block_type(values.dtype)
  return klass(values, ndim=ndim, placement=placement, refs=refs)

E TypeError: Argument 'values' has incorrect type (expected pandas._libs.arrays.NDArrayBacked, got numpy.ndarray)

.nox/compliance_prerelease/lib/python3.11/site-packages/pandas/core/internals/blocks.py:2392: TypeError

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigqueryIssues related to the googleapis/python-db-dtypes-pandas API.flakybot: flakyTells the Flaky Bot not to close or comment on this issue.flakybot: issueAn issue filed by the Flaky Bot. Should not be added manually.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions