Thanks to visit codestin.com
Credit goes to github.com

Skip to content

concatenating with empty list changes dtype to float64 #10135

Closed
@nschloe

Description

@nschloe

When concatenating anything with an empty list, the dtype of the result is augmented to float64.

MWE:

import numpy

print(numpy.concatenate([[0]]).dtype)  # int64
print(numpy.concatenate([[0], [1]]).dtype)  # int64
print(numpy.concatenate([[0], []]).dtype)  # float64!
print(numpy.concatenate([[], [0]]).dtype)  # float64!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions