str2d.Str2D.reshape
- Str2D.reshape(shape: Tuple[int, int]) Str2D [source]
Reshape the Str2D object. This is a wrapper around the reshape method of the structured array.
- Parameters:
shape (Tuple[int, int]) – The new shape of the Str2D object.
- Returns:
A new Str2D object with the reshaped data.
- Return type:
Examples
Let’s create an instance of Str2D and assign it to the variable a.
from str2d import Str2D a = Str2D('a b c d\ne f g\nh i\nj') a
a b c d e f g h i j
We can reshape the Str2D object to have a shape of (2, 8).
a.reshape((1, -1))
a b c de f g h i j