Skip to content

Use .T instead of numpy.transpose() for 2D array transpose #107

@SaFE-APIOpt

Description

@SaFE-APIOpt

runs_t = numpy.transpose(runs)

In the code:
runs = numpy.column_stack((nr, val)) runs_t = numpy.transpose(runs)
it's recommended to replace numpy.transpose() with .T:
runs_t = runs.T
Both approaches are equivalent for 2D arrays, but .T is more concise and performs slightly better since it directly accesses the array’s transpose attribute, avoiding unnecessary function call overhead. This small change improves both code clarity and efficiency.

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