@@ -5630,7 +5630,7 @@ cannot be safely cast to variable data type""" % attname
56305630 # create a view so shape in caller is not modified (issue 90)
56315631 try : # if extra singleton dims, just reshape
56325632 data = data.view()
5633- data.shape = tuple (datashape)
5633+ data = data.reshape( tuple (datashape) )
56345634 except ValueError : # otherwise broadcast
56355635 data = numpy.broadcast_to(data, datashape)
56365636
@@ -6821,8 +6821,7 @@ and shape `a.shape + (N,)`, where N is the length of each string in a."""
68216821 if encoding in [' none' ,' None' ,' bytes' ]:
68226822 b = numpy.array(tuple (a.tobytes()),' S1' )
68236823 elif encoding == ' ascii' :
6824- b = numpy.array(tuple (a.tobytes().decode(encoding)),dtype+ ' 1' )
6825- b.shape = a.shape + (n_strlen,)
6824+ b = (numpy.array(tuple (a.tobytes().decode(encoding)),dtype+ ' 1' )).reshape(a.shape + (n_strlen,))
68266825 else :
68276826 if not a.ndim:
68286827 a = numpy.array([a])
@@ -6862,8 +6861,7 @@ returns a numpy string array with datatype `'UN'` (or `'SN'`) and shape
68626861 a = numpy.array([bs[n1:n1+ slen] for n1 in range (0 ,len (bs),slen)],' S' + repr (slen))
68636862 else :
68646863 a = numpy.array([bs[n1:n1+ slen].decode(encoding) for n1 in range (0 ,len (bs),slen)],' U' + repr (slen))
6865- a.shape = b.shape[:- 1 ]
6866- return a
6864+ return a.reshape(b.shape[:- 1 ])
68676865
68686866class MFDataset (Dataset ):
68696867 """
0 commit comments