You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Use .T instead of np.transpose() for better performance and readability #83
In the following code: if numpy.ndim(self.ydata) == 2: self.ydata = numpy.transpose(self.ydata)
it's better to replace np.transpose() with the shorthand .T: if numpy.ndim(self.ydata) == 2: self.ydata = self.ydata.T
Both versions produce the same result for 2D arrays, but .T is more efficient as it directly accesses the array’s transpose property without invoking a function call. It also improves code clarity and conforms to standard NumPy coding practices.
Activity