Skip to content

Bug with the "unique" function #42733

@Leon6j

Description

@Leon6j

I notice that any NaN values inside a data will mess up Julia’s unique function.

For example I have a matrix A with 3 duplicate rows:

A = [1 NaN 3; 1 NaN 3; 1 NaN 3];
3×3 Matrix{Float64}:
 1.0  NaN  3.0
 1.0  NaN  3.0
 1.0  NaN  3.0

If we apply unique to it as below:

B = unique(A, dims=1)

We would expect the B to be like this:

1×3 Matrix{Float64}:
 1.0  NaN  3.0

But in reality, the B generated by Julia is as below:

4×3 Matrix{Float64}:
 1.0  NaN  3.0
 1.0  NaN  3.0
 1.0  NaN  3.0
 1.0  NaN  3.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @KristofferC@Leon6j

      Issue actions

        Bug with the "unique" function · Issue #42733 · JuliaLang/julia