Skip to content

Incorrect behavior of ElementwiseGreaterThanOrEqual with DateTime – acts as equality check #7474

Open
@vsarakhan

Description

@vsarakhan

System Information (please complete the following information):

  • OS & Version: MacOs 15.3.2
  • Microsoft.Data.Analysis Version: 0.22.2
  • .NET Version: 9.0

Describe the bug
I’ve found a bug in the ElementwiseGreaterThanOrEqual implementation for DateTimeDataFrameColumn. It performs an equality check instead of checking for “greater than or equal”.

To Reproduce
Steps to reproduce the behavior:

  1. Create a DateTimeDataFrameColumn with some sample DateTime values
  2. Call the ElementwiseGreaterThanOrEqual method using a value that is less than some of the values in the column
  3. Observe that only values equal to the given value are marked as true

Expected behavior
ElementwiseGreaterThanOrEqual should return true for values that are either equal to or greater than the comparison value.

For example:

  • Input: [2020-01-01, 2021-01-01, 2022-01-01]
  • Comparison value: 2021-01-01
  • Expected result: [false, true, true]

Screenshots, Code, Sample Projects

using Microsoft.Data.Analysis;
using System;

var dates = new DateTimeDataFrameColumn("Dates", new[]
{
    new DateTime(2020, 1, 1),
    new DateTime(2021, 1, 1),
    new DateTime(2022, 1, 1),
});
var result = dates.ElementwiseGreaterThanOrEqual(new DateTime(2021, 1, 1));
Console.WriteLine(result); // Expected: [false, true, true], Actual: [false, true, false]

**Additional context**
-

Metadata

Metadata

Assignees

No one assigned

    Labels

    untriagedNew issue has not been triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions